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.\" $FreeBSD$ 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 su 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 su 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. 115Envronment 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 su 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 su 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 in group 0 (normally 153.Dq wheel ) 154can 155.Nm su 156to 157.Dq root . 158.Pp 159By default (unless the prompt is reset by a startup file) the super-user 160prompt is set to 161.Dq Sy \&# 162to remind one of its awesome power. 163.Sh SEE ALSO 164.Xr csh 1 , 165.Xr kerberos 1 , 166.Xr kinit 1 , 167.Xr login 1 , 168.Xr sh 1 , 169.Xr group 5 , 170.Xr login.conf 5 , 171.Xr passwd 5 , 172.Xr environ 7 173.Sh ENVIRONMENT 174Environment variables used by 175.Nm su : 176.Bl -tag -width HOME 177.It Ev HOME 178Default home directory of real user ID unless modified as 179specified above. 180.It Ev PATH 181Default search path of real user ID unless modified as specified above. 182.It Ev TERM 183Provides terminal type which may be retained for the substituted 184user ID. 185.It Ev USER 186The user ID is always the effective ID (the target user ID) after an 187.Nm su 188unless the user ID is 0 (root). 189.El 190.Sh EXAMPLES 191.Bl -tag -width 5n -compact 192.It Li "su man -c catman" 193Runs the command 194.Li catman 195as user 196.Li man . 197You will be asked for man's password unless your real UID is 0. 198.It Li "su man -c 'catman /usr/share/man /usr/local/man /usr/X11R6/man'" 199Same as above, but the target command constitutes of more than a 200single word. 201.It Li "su -l foo" 202Pretend a login for user 203.Li foo . 204.El 205.Sh HISTORY 206A 207.Nm 208command appeared in 209.At v1 . 210