Hello I have a problem I order a ubuntu linux server with a dedicated server and wish to enter as root ssh but when I type the command sudo root it gives me an error ?

Recommended Answers

All 5 Replies

sudo root is wrong.
sudo allows you to enter a command with root privileges.
To become root you issue the command su.

Of course for that you need to know the root password... And on ubuntu at least the root account is disbabled by default, needs to be enabled before you can log in as root or use su to become root. Search for the commands to do that.

Also, if you're renting a server or vps you may not even have root access, depending on your hosting plan (this especially if you are renting a managed server).

TBH most things you can achieve with the root account you can also do with sudo.

Hello,

What you really need it to also have all of the paths and other variables that would be set if you were root. If you add a dash (-) to the su command then it loads the environment of the user you are switching to (i.e. su - bob Will load and run bob's .profile and .bash_rc files). So if you really want to su to root using sudo use :

sudo su -

If you find that you need more time as root than as a user create a root password:

sudo passwd

Enter your user password, then enter a root user password. From that point you can become root with the command:

su

Okay, there's quite a bit going on in here...

My first suggestion would, of course, be that you read the friendly man page: man sudo.

Please note that this is hardly ever meant sarcastically, it's normally just the man page answers a lot of questions you may not even have the necessary frame of reference to form as yet.

Be that as it may, please consider the following:

eroux@Fafnir:~$ sudo -l
Matching Defaults entries for eroux on this host:
    blah blah blah...

User eroux may run the following commands on this host:
    (ALL) ALL
eroux@Fafnir:~$

If you see this, it means that your user (instead of my eroux, of course) has been created as an administrator on your server, with full sudo access with password authentication.

This is as opposed to the following, where you have full sudo access without a password:

eroux@Fafnir:~$ sudo -l
Matching Defaults entries for eroux on this host:
    blah blah blah...

User eroux may run the following commands on this host:
    (ALL) NOPASSWD: ALL
eroux@Fafnir:~$

In either of these cases, a sudo -s will allow you to access the root shell.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.