24
2
If I enter in the password to su
when prompted, it doesnt work while sudo su
does. Also, when a command is executed using sudo (command)
, does sudo automatically execute it by root by default (since the man page says sudo, sudoedit - execute a command as another user
michaelxu@michaelxu-server:~$ su
Password:
su: Authentication failure
michaelxu@michaelxu-server:~$ sudo su
[sudo] password for michaelxu:
root@michaelxu-server:/home/michaelxu# exit
7One other important bit of information to understand the related command
sudo su otheruser
is thatsu
allows the root to switch into any users without entering their password, while non-root users that runssu
have to input the target user's password.sudo su
therefore runssu
as root, which allows you to get a shell for another user without knowing their password (as long as it's allowed by sudoers). – Lie Ryan – 2013-04-25T09:06:57.090So what would my root password be for the "su" command? How come it isnt the password I set in the beginning of the installation? – agz – 2013-04-25T23:23:07.287
Because your distribution probably didn't set it. You can set a root password running
sudo passwd
(first provide your user password, then choose a new root password). – Renan – 2013-04-26T00:41:54.093So at the moment there is no password?...so basically root is just an account that sudoers can use to make changes to root files? – agz – 2013-04-26T03:18:54.680
not just that, there are many other services that have to run as root (check
ps aux
). – Renan – 2013-04-26T06:15:47.867