RunAs / Run As in Linux terminal (Bash) #

su (switch user) is especially handy when you are logged in as a limited user and need to run commands as an administrator:

$ su admin

su maintains the previous user's shell environment unless a dash in included:

$ su - admin
Password:
$ pwd
/home/admin


If su is run without specifying a user, root is assumed. Note that in Ubuntu (and all Debian-based distros) root is disabled by default. Attempting to run su alone returns an "Authentication failure"; use sudo su instead.

/nix | Jun 25, 2012


Subscribe or visit the archives.