1.\" Copyright (c) 1988, 1990, 1993, 1994 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)su.1 8.2 (Berkeley) 4/18/94 33.\" $Id: su.1,v 1.10 1997/08/30 12:22:48 jmg Exp $ 34.\" 35.\" this is for hilit19's braindeadness: " 36.Dd April 18, 1994 37.Dt SU 1 38.Os 39.Sh NAME 40.Nm su 41.Nd substitute user identity 42.Sh SYNOPSIS 43.Nm 44.Op Fl Kflm 45.Op Ar login Op Ar args 46.Sh DESCRIPTION 47.Nm Su 48requests the Kerberos password for 49.Ar login 50(or for 51.Dq Ar login Ns .root , 52if no login is provided), and switches to 53that user and group ID after obtaining a Kerberos ticket granting ticket. 54A shell is then executed. 55.Nm Su 56will resort to the local password file to find the password for 57.Ar login 58if there is a Kerberos error. 59If 60.Nm 61is executed by root, no password is requested and a shell 62with the appropriate user ID is executed; no additional Kerberos tickets 63are obtained. 64.Pp 65By default, the environment is unmodified with the exception of 66.Ev USER , 67.Ev HOME , 68and 69.Ev SHELL . 70.Ev HOME 71and 72.Ev SHELL 73are set to the target login's default values. 74.Ev USER 75is set to the target login, unless the target login has a user ID of 0, 76in which case it is unmodified. 77The invoked shell is the target login's. 78This is the traditional behavior of 79.Nm su . 80Resource limits and session priority applicable to the original user's 81login class (See 82.Xr login.conf 5 ) 83are also normally retained unless the target login as a user ID of 0. 84.Pp 85The options are as follows: 86.Bl -tag -width Ds 87.It Fl K 88Do not attempt to use Kerberos to authenticate the user. 89.It Fl f 90If the invoked shell is 91.Xr csh 1 , 92this option prevents it from reading the 93.Dq Pa .cshrc 94file. 95.It Fl l 96Simulate a full login. 97The environment is discarded except for 98.Ev HOME , 99.Ev SHELL , 100.Ev PATH , 101.Ev TERM , 102and 103.Ev USER . 104.Ev HOME 105and 106.Ev SHELL 107are modified as above. 108.Ev USER 109is set to the target login. 110.Ev PATH 111is set to 112.Dq Pa /bin:/usr/bin . 113.Ev TERM 114is imported from your current environment. 115Environment variables may be set or overridden from the login class 116capabilities database according to the class of the target login. 117The invoked shell is the target login's, and 118.Nm 119will change directory to the target login's home directory. 120Resource limits and session priority are modified to that for the 121target account's login class. 122.It Fl m 123Leave the environment unmodified. 124The invoked shell is your login shell, and no directory changes are made. 125As a security precaution, if the target user's shell is a non-standard 126shell (as defined by 127.Xr getusershell 3 ) 128and the caller's real uid is 129non-zero, 130.Nm 131will fail. 132.El 133.Pp 134The 135.Fl l 136and 137.Fl m 138options are mutually exclusive; the last one specified 139overrides any previous ones. 140.Pp 141If the optional 142.Ar args 143are provided on the command line, they are passed to the login shell of 144the target login. This allows it to pass arbitrary commands via 145the 146.Fl c 147option as understood by most shells. Note that 148.Fl c 149usually expects a single argument only; you have to quote it when 150passing multiple words. 151.Pp 152Only users listed in group 0 (normally 153.Dq wheel ) 154can 155.Nm 156to 157.Dq root , 158unless this group is empty. 159.Pp 160When using 161.Nm 162to become super-user, note that the invoked shell dictates the new 163command prompt and not 164.Nm su . 165Even when 166.Nm 167is invoked with the 168.Fl l 169option, the command prompt is still determined by the shell's startup 170files, specifically their manipulation of the 171.Ev PS1 172variable. 173.Sh SEE ALSO 174.Xr csh 1 , 175.Xr kerberos 1 , 176.Xr kinit 1 , 177.Xr login 1 , 178.Xr sh 1 , 179.Xr group 5 , 180.Xr login.conf 5 , 181.Xr passwd 5 , 182.Xr environ 7 183.Sh ENVIRONMENT 184Environment variables used by 185.Nm su : 186.Bl -tag -width HOME 187.It Ev HOME 188Default home directory of real user ID unless modified as 189specified above. 190.It Ev PATH 191Default search path of real user ID unless modified as specified above. 192.It Ev TERM 193Provides terminal type which may be retained for the substituted 194user ID. 195.It Ev USER 196The user ID is always the effective ID (the target user ID) after an 197.Nm 198unless the user ID is 0 (root). 199.El 200.Sh EXAMPLES 201.Bl -tag -width 5n -compact 202.It Li "su man -c catman" 203Runs the command 204.Li catman 205as user 206.Li man . 207You will be asked for man's password unless your real UID is 0. 208.It Li "su man -c 'catman /usr/share/man /usr/local/man /usr/X11R6/man'" 209Same as above, but the target command constitutes of more than a 210single word. 211.It Li "su -l foo" 212Pretend a login for user 213.Li foo . 214.El 215.Sh HISTORY 216A 217.Nm 218command appeared in 219.At v1 . 220