Definition:

  • run a command with substitute user and group ID
    • must enter target password
  • When called with no user specified, su defaults to running an interactive shell as root.
  • retains the original user’s profile and variables.
    • The switched user also remains in the home directory.
  • Anyone using su except the root user will be challenged for the password of the user account they are switching to.
  • Using su with a hyphen following it (su - user) enables a user to change users and launch a new shell under the context of that new user.
    • This is a much better practice. Anyone using the su - except the root user will be challenged for the password of the user they are switching to.
    • It is most common to switch to the root user, but any user can switch to any other user as long as they know that user’s password.
    • Without a user name argument, the su - command will assume to sign in as root

Synopsis:

  • su [options] [-] [user [argument...]]

List of options:

  • -, -l, --login
    • without this:
      • witch user and identity but keep current profile (directory, shell,…)
    • with:
      • also go to target user’s home directory
      • similar to relogin