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.\" 34.\" this is for hilit19's braindeadness: " 35.Dd April 18, 1994 36.Dt SU 1 37.Os 38.Sh NAME 39.Nm su 40.Nd substitute user identity 41.Sh SYNOPSIS 42.Nm su 43.Op Fl Kflm 44.Op Ar login Op Ar args 45.Sh DESCRIPTION 46.Nm Su 47requests the Kerberos password for 48.Ar login 49(or for 50.Dq Ar login Ns .root , 51if no login is provided), and switches to 52that user and group ID after obtaining a Kerberos ticket granting ticket. 53A shell is then executed. 54.Nm Su 55will resort to the local password file to find the password for 56.Ar login 57if there is a Kerberos error. 58If 59.Nm su 60is executed by root, no password is requested and a shell 61with the appropriate user ID is executed; no additional Kerberos tickets 62are obtained. 63.Pp 64By default, the environment is unmodified with the exception of 65.Ev USER , 66.Ev HOME , 67and 68.Ev SHELL . 69.Ev HOME 70and 71.Ev SHELL 72are set to the target login's default values. 73.Ev USER 74is set to the target login, unless the target login has a user ID of 0, 75in which case it is unmodified. 76The invoked shell is the target login's. 77This is the traditional behavior of 78.Nm su . 79.Pp 80The options are as follows: 81.Bl -tag -width Ds 82.It Fl K 83Do not attempt to use Kerberos to authenticate the user. 84.It Fl f 85If the invoked shell is 86.Xr csh 1 , 87this option prevents it from reading the 88.Dq Pa .cshrc 89file. 90.It Fl l 91Simulate a full login. 92The environment is discarded except for 93.Ev HOME , 94.Ev SHELL , 95.Ev PATH , 96.Ev TERM , 97and 98.Ev USER . 99.Ev HOME 100and 101.Ev SHELL 102are modified as above. 103.Ev USER 104is set to the target login. 105.Ev PATH 106is set to 107.Dq Pa /bin:/usr/bin . 108.Ev TERM 109is imported from your current environment. 110The invoked shell is the target login's, and 111.Nm su 112will change directory to the target login's home directory. 113.It Fl m 114Leave the environment unmodified. 115The invoked shell is your login shell, and no directory changes are made. 116As a security precaution, if the target user's shell is a non-standard 117shell (as defined by 118.Xr getusershell 3 ) 119and the caller's real uid is 120non-zero, 121.Nm su 122will fail. 123.El 124.Pp 125The 126.Fl l 127and 128.Fl m 129options are mutually exclusive; the last one specified 130overrides any previous ones. 131.Pp 132If the optional 133.Ar args 134are provided on the command line, they are passed to the login shell of 135the target login. This allows it to pass arbitrary commands via 136the 137.Fl c 138option as understood by most shells. Note that 139.Fl c 140usually expects a single argument only; you have to quote it when 141passing multiple words. 142.Pp 143Only users in group 0 (normally 144.Dq wheel ) 145can 146.Nm su 147to 148.Dq root . 149.Pp 150By default (unless the prompt is reset by a startup file) the super-user 151prompt is set to 152.Dq Sy \&# 153to remind one of its awesome power. 154.Sh SEE ALSO 155.Xr csh 1 , 156.Xr login 1 , 157.Xr sh 1 , 158.Xr kinit 1 , 159.Xr kerberos 1 , 160.Xr passwd 5 , 161.Xr group 5 , 162.Xr environ 7 163.Sh ENVIRONMENT 164Environment variables used by 165.Nm su : 166.Bl -tag -width HOME 167.It Ev HOME 168Default home directory of real user ID unless modified as 169specified above. 170.It Ev PATH 171Default search path of real user ID unless modified as specified above. 172.It Ev TERM 173Provides terminal type which may be retained for the substituted 174user ID. 175.It Ev USER 176The user ID is always the effective ID (the target user ID) after an 177.Nm su 178unless the user ID is 0 (root). 179.El 180.Sh EXAMPLES 181.Bl -tag -width 5n -compact 182.It Li "su man -c catman" 183Runs the command 184.Li catman 185as user 186.Li man . 187You will be asked for man's password unless your real UID is 0. 188.It Li "su man -c 'catman /usr/share/man /usr/local/man /usr/X11R6/man'" 189Same as above, but the target command constitutes of more than a 190single word. 191.It Li "su -l foo" 192Pretend a login for user 193.Li foo . 194.El 195.Sh HISTORY 196A 197.Nm 198command appeared in 199.At v7 . 200