1

Is there any difference between "sudo su root" and "sudo su - root" ? I know - make the shell a login shell but what difference does it make ? Does the permission varies among them or any change in environment variable happens ?

3

Login shells run ~/.profile (or the shell-specific equivalent: .login for *csh, .bash_profile, .zshprofile, etc.). Without the -, only a shell-specific interactive config will be run (.cshrc, .bashrc, .zshenv; nothing for ash or derivatives thereof, or for ksh unless $ENV is set properly and sudo propagates it). Also note that sudo can be configured as to how it sets $HOME, which determines whether it's the target account's dotfiles or your own that are used (Debian derivatives use the former, OS X the latter by default) — but using su along with it will override this to the target account in all cases.

|improve this answer|||||

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.