DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Switch User Command in Linux


Switch user command (su) has the following forms:

su

Switch to , without loading environment variables. If is omitted (only "su"), it equals to "su root";

su -

Switch to , and loading environment variables. "-" is the abbreviation of "-l", which means this is a "login" shell, so all .profile will be sourced (man su for details). If is omitted (only "su -"), it equals to "su - root";

su -c ""

Run command with the identity of another user. It is mostly used in one-off command with root privileges:

su -c "" root

The double quotes around can't be omitted.



Published

Dec 19, 2013

Last Updated

Dec 19, 2013

Category

Tech

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor