Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ su(1) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sh

su

PURPOSE

     Obtains the privileges of  another user, including super-
     user authority.

SYNOPSIS
     su [ - ] [ name [ arg ... ] ]


DESCRIPTION

     The su  command runs a  shell and lets you  operate there
     with  the privileges  of the  specified user  (by default
     "root").

     If you use  su to become the superuser  (user is "root"),
     su  sets  the  PATH variable  to  /bin:/etc:/usr/bin  and
     changes the prompt  to # (pound sign).   Notice that this
     PATH does not include the  current directory.  If you are
     not  already  operating   with  superuser  authority,  su
     prompts  for the  password  associated  with user  before
     granting you these privileges.

     To  restore your  normal  privileges, press  END OF  FILE
     (Ctrl-D).  This  action ends the  shell called by  su and
     returns you to the previous shell and ID.

     If you need to run only  one command as user, you can run
     the desired  command by including  it (along with  any of
     its associated flags) on the  command line as an argument
     to the shell -c flag (see  "sh" for a description of this
     flag).  In this case, su calls  sh to run the command and
     then exits automatically.

     Each time  someone uses  su to  become the  superuser, su
     writes a record in the file /usr/adm/sulog, creating this
     file if necessary.

     Note:  If  the -c option  is not specified, su  execs the
     shell listed in the shell  field of the /etc/passwd file.
     If the -c  flag is specified, su ignores  the passwd file
     entry and  runs /bin/sh.  All exported  environment vari-
     ables are  available unless you  use the - flag  when you
     call su.

FLAGS

     -                Creates the same environment for the new
                      shell as the login  shell of user.  This
                      is done  by calling  the new shell  as a
                      login shell (see "sh"),  so it reads the
                      system  profile  file   and  the  user's
                      $HOME/.profile  file.   The  environment
                      variables NLLDATE and NLTIME control the

                      appearance  of the  date and  time.  The
                      TERM and TZ  variables are an exception.
                      They  are  preserved  at  their  current
                      values.   These  variables are  normally
                      set by init or  getty prior to login; so
                      su handles them differently.

                      Note:  This  flag modifies  the environ-
                      ment of  the current  shell only  if the
                      optional  program  named  in  the  shell
                      field of  the passwd  file is  a program
                      like sh.
     -c "cmdstring"   Runs  the /bin/sh  shell, processes  the
                      specified  command, and  then exits  the
                      shell.   This flag  causes su  to ignore
                      the shell specified in the passwd file.

EXAMPLES

     1.  To obtain superuser authority:

           su

         This runs a  subshell with the effective  user ID and
         privileges of user "root".  The su command asks for a
         password, as if  you were logging in  as "root".  Now
         the commands you run have superuser authority.  Press
         END OF FILE (Ctrl-D) to  end  the subshell and return
         to your original shell session and privileges.
     2.  To obtain "jim"'s privileges:

           su  jim

         This runs a  subshell with the effective  user ID and
         privileges of "jim".
     3.  To set up the environment as  if you had logged in as
         "jim":

           su  -  jim

         This runs a  subshell with the effective  user ID and
         privileges of "jim".  The - causes the shell variable
         LOGNAME to  be set to  "jim", HOME  to be set  to the
         path  name of  "jim"'s  home  directory, and  "jim"'s
         $HOME/.profile shell procedure file  to be run before
         prompting for the first shell command.
     4.  To run a single command with superuser authority:

           su  root  -c "backup  -9  -u"

         This  runs  the shell  command  "backup  -9 -u"  with
         superuser  authority   (if  you  know   the  password
         assigned to "root").

RELATED INFORMATION

     The following command:  "sh."

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026