I have tried this on Fedora and on Ubuntu.
kshitiz@kshitiz:~$su
su: Authentication failure
kshitiz@kshitiz:~$sudo su
root@kshitiz:/home/kshitiz#
I am entering the same password in both the cases.
I have tried this on Fedora and on Ubuntu.
kshitiz@kshitiz:~$su
su: Authentication failure
kshitiz@kshitiz:~$sudo su
root@kshitiz:/home/kshitiz#
I am entering the same password in both the cases.
su requires the password of the account whose privileges you are trying to assume (apparently root in this case).
sudo requires the password of the current user - that is, the password for user kshitiz.
By running sudo su, you are effectively becoming root, then running su to get a root shell - that is, your privileges are already elevated to root before the call to su is executed, which is why you don't get prompted for the root password again.
su uses the root password, while sudo uses the current user password. At least in Ubuntu the root password is scrambled during installation.
In fact, you can specify in the /etc/sudoers file (use visudo) which password the user who issues sudo has to enter. If these lines
# Defaults targetpw
# ALL ALL = (ALL) ALL
were uncommented, you would have to enter the root-password to run passwords with root-permissions via sudo.
suwith no arguments is because it stands for "switch user" (not "super user") but, if you don't specify anything, the default is root. You can, however, specify anyone, eg. "su kshitiz" -- in which case you would need kshitiz's password, not root's. Make sense? – goldilocks Mar 13 '13 at 11:52sudois to give selected users permissions to run some programs as root (or other users). This way those users can run any program as root. It is a bit safer than letting Joe Random switch to root to do something (and stay there!), but not much better. As configuration for personal machines it is fine, elsewhere a much more careful configuration is required. – vonbrand Mar 13 '13 at 14:01