0

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 ?

6
Contributors
5
Replies
29
Views
2 Years
Discussion Span
Last Post by eroux
0

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.

0

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 -

0

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

Edited by DetroitGeek

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.