From ArchWiki
Revision as of 01:54, 16 July 2009 by Fukawi2 (talk | contribs)
Jump to: navigation, search

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Su#)

The 'su' command is used to assume the identity of another user on the system, normally root. This saves having to logout and log back in as the user you want to be.

su'ing to a new user

To assume the login of another user, pass the username that you want to become to su

su http

You will be prompted for the password of the user you are attempting to become.

If no username is passed, su assumes the root user.

Login Shell

Normally you will want to run su with the '-' option. This makes the login behave as if you just logged in as that user directly, rather than inheriting your current environment:

su -

You may wish to add an alias to ~/.bashrc for this:

alias su="su -"


From a security perspective, it is better to setup the use of 'sudo' instead of 'su'. The 'sudo' system will prompt you for your own password rather than that of the user you are attempting to become. This way you do not have to share passwords between users, and if you ever need to stop a user having access to the root (or any other account), you don't have to change the root password (which would inconvenience everyone else), you would just need to revoke that users sudo access.

Allow Only the "wheel" Group to run su

Uncomment the appropriate line in /etc/pam.d/su

auth           required use_uid