Substitute user identity.
Switch to a different user/group ID. A shell is executed, and additional arguments may be passed to the shell.
If su is executed by root, no password is requested.

      su [-flm] [login] [-c shell arguments]

     -c     Invoke the following command in a subshell as the specified user.

     -f     If the invoked shell is csh(1), this option prevents it from
            reading the `.cshrc' file.

     -l     Simulate a full login.  The environment is discarded except for
       HOME, SHELL, PATH, TERM, and USER.   HOME and SHELL are modified
       as above.  USER is set to the target login.  PATH is set to
       `/bin:/usr/bin'.   TERM is imported from your current environ-
       ment.  The invoked shell is the target login's, and su will
       change directory to the target login's home directory.  This
       option is identical to just passing "-", as in "su -".

     -m     Leave the environment unmodified.  The invoked shell is your
       login shell, and no directory changes are made.  As a security
       precaution, if the target user's shell is a non-standard shell
       (as defined by getusershell(3)) and the caller's real uid is non-
       zero, su will fail.

The -l and -m options are mutually exclusive; the last one specified overrides any previous ones.

Only users in group ``wheel'' (normally gid 0) or group ``admin'' (nor- mally gid 20) can su to ``root''.
under macOS 10.2, nobody is a member of "wheel" so this is effectively forbidden. Use sudo instead.

By default (unless the prompt is reset by a startup file) the super-user prompt is set to ``#'' to remind one of its awesome power.

su uses the environment variables: HOME, PATH, TERM and USER.

“It was just like Romeo and Juliet, only it ended in tragedy” ~ Milhouse (The Simpsons)

Related macOS commands

suspend - Stop the shell in its tracks, much as if it had been sent a stop signal with ^Z

Copyright © 1999-2024
Some rights reserved