Flush out the last dregs in the terminal before quitting when
[unix-history] / usr / src / usr.bin / su / su.1
index d34105f..aad9ae1 100644 (file)
@@ -1,55 +1,59 @@
-.\" Copyright (c) 1980 Regents of the University of California.
-.\" All rights reserved.  The Berkeley software License Agreement
-.\" specifies the terms and conditions for redistribution.
+.\" Copyright (c) 1988 The Regents of the University of California.
+.\" All rights reserved.
 .\"
 .\"
-.\"    @(#)su.1        6.2 (Berkeley) %G%
+.\" Redistribution and use in source and binary forms are permitted
+.\" provided that the above copyright notice and this paragraph are
+.\" duplicated in all such forms and that any documentation,
+.\" advertising materials, and other materials related to such
+.\" distribution and use acknowledge that the software was developed
+.\" by the University of California, Berkeley.  The name of the
+.\" University may not be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
+.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+.\"
+.\"    @(#)su.1        6.6 (Berkeley) %G%
 .\"
 .TH SU 1 ""
 .UC
 .SH NAME
 .\"
 .TH SU 1 ""
 .UC
 .SH NAME
-su \- substitute user id temporarily
+su \- substitute user id
 .SH SYNOPSIS
 .B su
 .SH SYNOPSIS
 .B su
-[ \-f ] [ \- ] [ userid ]
+[-flm] [login]
 .SH DESCRIPTION
 .SH DESCRIPTION
-.I Su
-demands the password of the specified
-.I userid,
-and if it is given,
-changes to that 
-.I userid
-and invokes the Shell
-.IR sh (1)
-or
-.IR csh (1)
-without changing the current directory.
-The user environment
-is unchanged except for HOME and SHELL,
-which are taken from the password file
-for the user being substituted
-(see
-.IR environ (7)).
-The new user ID stays in force until the Shell exits.
+\fISu\fP requests the password for \fIlogin\fP (or for ``root'', if no
+login is provided), and switches to that user and group ID.  A shell is
+then invoked.
+.PP
+By default, your environment is unmodified with the exception of
+\fIUSER\fP, \fIHOME\fP, and \fISHELL\fP.  \fIHOME\fP and \fISHELL\fP
+are set to the target login's \fI/etc/passwd\fP values.  \fIUSER\fP
+is set to the target login, unless the target login has a UID of 0,
+in which  case it is unmodified.  The invoked shell is the target
+login's.  This is the traditional behavior of \fIsu\fP.
+.PP
+The \fI-l\fP option simulates a full login.  The environment is discarded
+except for \fIHOME\fP, \fISHELL\fP, \fIPATH\fP, \fITERM\fP, and \fIUSER\fP.
+\fIHOME\fP and \fISHELL\fP are modified as above.  \fIUSER\fP is set to
+the target login.  \fIPATH\fP is set to ``/usr/ucb:/bin:/usr/bin''.
+\fITERM\fP is imported from your current environment.  The invoked shell
+is the target login's, and \fIsu\fP will change directory to the target
+login's home directory.
+.PP
+The \fI-m\fP option causes the environment to remain unmodified, and
+the invoked shell to be your login shell.  No directory changes are
+made.  As a security precaution, if the target shell is not a standard
+shell (as defined by \fIgetusershell\fP(3)) it is invoked instead of
+your login shell.
 .PP
 .PP
-If no 
-.I userid
-is specified, ``root'' is assumed.
-Only users in the ``wheel'' group (group 0) can
-.I su
-to ``root'', even with the root password.
-To remind the super-user of his responsibilities,
-the Shell substitutes `#' for its usual prompt.
+If the invoked shell is \fIcsh\fP, the \fI-f\fP option prevents it from
+reading the \fI.cshrc\fP file.  Otherwise, this option is ignored.
 .PP
 .PP
-The
-.B \-f
-option prevents
-.IR csh (1)
-from executing the .cshrc file; thus making
-.I su
-start up faster.
+Only users in group 0 (normally ``wheel'') can \fIsu\fP to ``root''.
 .PP
 .PP
-The
-.B \-
-option simulates a full login.
+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.
 .SH "SEE ALSO"
 .SH "SEE ALSO"
-sh(1), csh(1)
+csh(1), login(1), sh(1), passwd(5), group(5), environ(7)