Su (Unix)

The Unix command su, which stands for substitute user, is used by a computer user to execute commands with the privileges of another user account. When executed it invokes a shell without changing the current working directory or the user environment.

When the command is used without specifying the new user id as a command line argument, it defaults to using the superuser account (user id 0) of the system.

## Contents

* 1 History
* 2 Usage
* 3 See also
* 4 References
* 5 External links

## History

The command su, including the Unix permissions system and the setuid system call, was part of Version 1 Unix. Encrypted passwords appeared in Version 3.[1]

## Usage

When run from the command line, su asks for the target user's password, and if authenticated, grants the operator access to that account and the files and directories that account is permitted to access.

john@localhost:~$ su jane
Password:
jane@localhost:/home/john$ exit
logout
john@localhost:~$

When used with a hyphen (`su -`) it can be used to start a login shell. In this mode users can assume the user environment of the target user.

john@localhost:~$ su - jane
Password:
jane@localhost:~$

The command sudo is related, and executes a command as another user but observes a set of constraints about which users can execute which commands as which other users (generally in a configuration file named `/etc/sudoers`, best editable by the command `visudo`). Unlike `su`, `sudo` authenticates users against their own password rather than that of the target user (to allow the delegation of specific commands to specific users on specific hosts without sharing passwords among them and while mitigating the risk of any unattended terminals).

Some Unix-like systems implement the user group wheel, and only allow members to become root with su.[2] This may or may not mitigate these security concerns, since an intruder might first simply break into one of those accounts. GNU su, however, does not support the group wheel for philosophical reasons. Richard Stallman argues that because the group would prevent users from utilizing root passwords leaked to them, the group would allow existing admins to ride roughshod over ordinary users.[3]

## See also

* Unix security
* List of Unix commands
* Comparison of privilege authorization features

## References

1. ↑ McIlroy, M. D. (1987). A Research Unix reader: offticles annotated excerpts from the Programmer's Manual, 1971–1986 (PDF) (Technical report). CSTR. Bell Labs. 139.
2. ↑ Levi, Bozidar (2002). UNIX Administration: A Comprehensive Sourcebook for Effective Systems and Network Management. CRC Press. pp. 207. ISBN 0-8493-1351-1. https://archive.org/details/unixadministrati00levi_712.
3. ↑ "Why GNU su does not support the wheel group". Archived from the original on December 10, 2013. https://web.archive.org/web/20131210155635/http://www.gnu.org/software/coreutils/manual/html_node/su-invocation.html#index-fascism-2365.

## External links

* su — manual pages from GNU coreutils.
* `su(1)` – Linux User Commands Manual
* `su(1)` – FreeBSD General Commands Manual
* `su(1M)` – Solaris 10 System Administration Commands Reference Manual
* The su command — by The Linux Information Project (LINFO)

* v
* t
* e

Unix command-line interface programs and shell builtins

File system|

* cat
* chmod
* chown
* chgrp
* cksum
* cmp
* cp
* dd
* du
* df
* file
* fuser
* ln
* ls
* mkdir
* mv
* pax
* pwd
* rm
* rmdir
* split
* tee
* touch
* type
* umask

Processes|

* at
* bg
* crontab
* fg
* kill
* nice
* ps
* time

User environment|

* env
* exit
* logname
* mesg
* talk
* tput
* uname
* who
* write

Text processing|

* awk
* basename
* comm
* csplit
* cut
* diff
* dirname
* ed
* ex
* fold
* head
* iconv
* join
* m4
* more
* nl
* paste
* patch
* printf
* sed
* sort
* strings
* tail
* tr
* uniq
* vi
* wc
* xargs

Shell builtins|

* alias
* cd
* echo
* test
* unset
* wait

Searching|

* find
* grep

Documentation|

* man

Software development|

* ar
* ctags
* lex
* make
* nm
* strip
* yacc

Miscellaneous|

* bc
* cal
* expr
* lp
* od
* sleep
* true and false

* Categories
* Standard Unix programs
* Unix SUS2008 utilities
* List

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Su (Unix). Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Su_(Unix)&oldid=260055"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template