DragonFly On-Line Manual Pages

Search: Section:  


SU2(8)                 DragonFly System Manager's Manual                SU2(8)

NAME

su2 - become another user

SYNOPSIS

su2 [ -u fromname ] [ -x ] [ -s ] [ -r ] [ -d ] [ -h ] [ -niceval ] [ toname ] [ -c file ]

DESCRIPTION

su2 allows one to become another user (usually root) without logging off or knowing the users password. The toname specifies the user to switch to. The default is the root user. To use su2, the fromuser's name must be listed in either the file /usr/local/etc/super-users or in the file .su2rc in the home directory of touser. The .su2rc file must be owned by touser, and the file's setuid bit must be set. Finally, fromuser's valid password must be specified. If the above conditions are met, su2 will execute a new shell (as specified by the $SHELL environment variable) with the user ID set to that of touser. If $SHELL is not defined, /bin/sh will be executed. To restore normal user ID privileges, type an EOF to the new shell. Su2 unlike su will not modify $PATH, unless the - option is specified. The only exception is any unanchored paths (those that do not begin with a "/") will be removed when changing to super-user. Su2 will also ensure that the super-user gets a "#" prompt to remind him of his additional responsibilities and removes the "#" prompt when switching from super-user. Su2 logs all attempts to su2 in /var/log/su2.log, including failures. Successful attempts are flagged with "+", failures with "-". The file /usr/local/etc/super-users contains a list of users, one to a line, that are authorized to su2 to any user. Each user's .su2rc file contains a similar list of users who may su2 to that user. A username may be prefixed by a "*" to bypass password checking when logged on as that user. A password will always be required if the -u option is specified. Care must be taken to insure that /usr/local/etc/super-users is writable only by root in order to prevent users from being able to add names to the list.

OPTIONS

-u is used to specify a user against whom to check authorization and password. The default value is obtained from /var/run/utmp. -x when specified will cause su2 to exec the shell without first forking a new process. This option should only be used when the system is out of process slots. When it is used su2 will neither clean up the /var/run/utmp entry nor reset the ownership and mode of the current /dev/tty??. Both may be reset with the -r option. -s will change the current /var/run/utmp entry to reflect the new user name. -r is used to replace the username in /var/run/utmp and the mode and ownership of /dev/tty?? with that associated with the current process userid. -d says to run a default shell (/bin/csh for BSD systems, /bin/sh for other systems). -h says to leave $HOME alone in case it would have been changed otherwise. This is needed if you don't use the @#$% C-hell. -c specifies a file to execute in the same fashion as the -c option of su(1). -niceval is a nice increment in the range -20 to 20. niceval is subtracted from the current nice value (similar to the nice(1) command). A negative value increases the effective priority.

FILES

/etc/passwd system's password file. /usr/local/etc/super-users authorized super-users for the system. $HOME/.su2rc list of users authorized to change to a specific user. /var/log/su2.log log of su2 and su attempts.

SEE ALSO

su(1), env(1), login(1), nice(1), sh(1), environ(7).

BUGS

The behavior of su2 is controlled by scads of compile-time options, so this document may not be accurate. The options should be replaced by flags. When run normally su2 will occupy 2 additional process slots which may pose a problem when trying to repair a swamped system. Using the -x option eliminates the second process. The code is full of explicit constants and pointer ugliness, and should probably be thrown out and rewritten. SU2(8)

Search: Section: