Asking because of curiosity. :)
When I type
sudo su
It asks for my user password. And when I type just
su
It asks for the root user password. But both the commands directs me to the root terminal. Then why is there such a difference?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communitysudo su
means run the command su
as sudo
which means as root. Here the system will ask you for your password since you are a sudoer. After you enter your password, you now have root privileges. So su
command won't ask for a password. It's same as if you are a root then su
to any other user will not ask for password because you are a root.
When you just run the command su
, you are running it as a regular user. Since su
means switch to user root, you will be asked for the root password.
su
andsudo su
notsudo -s
orsudo -s
– Maythux May 8 '15 at 7:58sudo su
. I've always wondered why this is so commonly suggested in the Ubuntu world. It is clumsy, inelegant and adds needless overhead. Just runsu
if you've set up the root account orsudo -i
if you haven't.sudo su
is just silly. – terdon May 8 '15 at 8:43sudo su
and inserting user password. Since majority of Linux users are workers under corporates, say IT, I guess this could be a reason. :) – Anonymous Platypus May 8 '15 at 9:16sudo -i
, orsudo -s
, you might also want to use-E
, depending on what you want to do. What you don't want issudo su
. Both because there's no reason to run two programs when one is enough and because that way you can control the resulting environment much better. – terdon May 8 '15 at 9:27