Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

su is unnecessary; sudo -s is equivalent to sudo su, but allows the admin to restrict who may sudo to whom, for which programs, and so on.


They are not equivalent. `sudo su` changes the values of USER, HOME, and SHELL to that of the root user. `sudo -s` only changes USER (it seems), but HOME is retained as the SUDO_USER's home directory.

Neither invocation changes the working directory, which is convenient.


Whether sudo sets $HOME depends on your /etc/sudoers configuration. Alternatively, sudo -Hs.


Indeed. I didn't know about `sudo -H`, though, so thank you.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: