It might be a duplicate and I'm pretty sure I already saw an answer to this somewhere, but I wondered what are the differences in terms of rights and variables and other stuff between sudo -s and sudo su -.

As far as I'm concerned, they both open a root shell, where I can do whatever I want, but I wondered if I could experience some differences one day.

Also this question on askUbuntu does not address my concerns.


sudo -s

Reads the $SHELL variable and executes the content. If $SHELL contains /bin/bash it invokes sudo /bin/bash. So, /bin/bash is started as non-login shell so all the dot-files are not executed, but bash itself reads .bashrc of the calling user. Your environment stays the same. Your home will not be root's home. So you are root, but in the environment of the calling user.

sudo su -

su - is invoked by sudo. Unlike sudo su (withput the dash), the shell is called as a login shell, so /etc/profile, .profile and .bashrc are executed and you will find yourself in root's home directory with root's environment.


| improve this answer | |
  • I was sure they were some differences – Kiwy Jul 22 '14 at 9:36
  • The later (su - <acct> also ensures that you parse the accounts environment files. – sleepyweasel Jan 24 '17 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.