Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Su (Unix)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Standard UNIX utility}} {{lowercase title}} {{Infobox software | name = su | logo = | screenshot = Su on Linux screenshot.png | screenshot size = | caption = | author = {{Plainlist| * [[Dennis Ritchie]] * [[Ken Thompson]] }} | developer = [[AT&T Bell Laboratories]] | released = {{Start date and age|1971|11|3}} | latest release version = | latest release date = | operating system = [[Unix]] and [[Unix-like]] | genre = [[Command (computing)|Command]] | license = | website = }} The [[Unix]] command '''{{mono|su}}''', which stands for "substitute user"<ref>{{Cite web | url = https://man7.org/linux/man-pages/man1/su.1.html | title = su(1) - Linux manual page | date = April 2, 2021 | quote = {{Mono|su - run a command with substitute user and group ID}} }}</ref><ref>{{Cite web | url = https://s3.amazonaws.com/plan9-bell-labs/7thEdMan/v7vol1.pdf | title = Unix Programmer's Manual, Seventh Edition, Volume 1 | page = 174 | date = January 1, 1979 | url-status = live | archive-url = https://web.archive.org/web/20220120180645/https://s3.amazonaws.com/plan9-bell-labs/7thEdMan/v7vol1.pdf | archive-date= Jan 20, 2022 | quote = {{mono|su - substitute user id temporarily}} }}</ref> (or historically "superuser"<ref>{{cite web | url = https://www.bell-labs.com/usr/dmr/www/man13.pdf | title = Unix Programmer's Manual | date = November 3, 1971 | page = 17 | url-status = live | archive-url = https://web.archive.org/web/20220317213155/https://www.bell-labs.com/usr/dmr/www/man13.pdf | archive-date= March 17, 2022 | quote = {{mono|su -- become privileged user... su allows one to become the super-user.}} }}</ref><ref>{{cite web | url = https://www.bell-labs.com/usr/dmr/www/pdfs/manindex.pdf | title = Unix Programmer's Manual - Table of Contents | date = November 3, 1971 | url-status = live | archive-url = https://web.archive.org/web/20220317213356/https://www.bell-labs.com/usr/dmr/www/pdfs/manindex.pdf | archive-date=March 17, 2022 | quote = {{mono|su: become super-user}} }}</ref>), is used by a computer user to execute commands with the privileges of another user account. When executed it invokes a [[shell (Unix)|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#Arguments|command line argument]], it defaults to using the [[superuser]] account (user id 0) of the system. == History == The command {{mono|su}}, including the [[Unix permissions]] system and the [[setuid]] system call, was part of [[Version 1 Unix]]. Encrypted passwords appeared in [[Version 3 Unix|Version 3]].<ref name="reader">{{cite tech report | first1 = M. D. | last1 = McIlroy | authorlink1 = Doug McIlroy | year = 1987 | url = https://www.cs.dartmouth.edu/~doug/reader.pdf | title = A Research Unix reader: offticles annotated excerpts from the Programmer's Manual, 1971β1986 | series = CSTR | number = 139 | institution = Bell Labs}}</ref> The command is available as a separate package for [[Microsoft Windows]] as part of the [[UnxUtils]] collection of [[Native (computing)|native]] [[Windows API|Win32]] [[porting|ports]] of common GNU Unix-like utilities.<ref>{{Cite web|url=http://unxutils.sourceforge.net/|title=Native Win32 ports of some GNU utilities|website=unxutils.sourceforge.net}}</ref> The {{mono|su}} command was removed from [[GNU_Core_Utilities|GNU coreutils]] as of release 8.18 (2012-08-12)<ref>{{Cite web|url=https://github.com/coreutils/coreutils/blob/master/NEWS|title=NEWS|website=[[GitHub]] |date=17 September 2022 }}</ref> and is currently included in the [[util-linux]] package. == 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. <syntaxhighlight lang="console"> john@localhost:~$ su jane Password: jane@localhost:/home/john$ exit logout john@localhost:~$ </syntaxhighlight> When used with a [[hyphen]] ({{mono|su -}}) it can be used to start a login shell. In this mode users can assume the user environment of the target user. <syntaxhighlight lang="console"> john@localhost:~$ su - jane Password: jane@localhost:~$ </syntaxhighlight> 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 {{mono|/etc/sudoers}}, best editable by the command {{mono|[[visudo]]}}). Unlike {{mono|su}}, {{mono|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 (computing)|wheel]]'', and only allow members to become root with {{mono|su}}.<ref name=levi>{{cite book | title = UNIX Administration: A Comprehensive Sourcebook for Effective Systems and Network Management | url = https://archive.org/details/unixadministrati00levi_712 | url-access = limited | first = Bozidar | last = Levi | publisher = CRC Press | year = 2002 | pages = [https://archive.org/details/unixadministrati00levi_712/page/n217 207] | isbn = 0-8493-1351-1}}</ref> This may or may not mitigate these security concerns, since an intruder might first simply break into one of those accounts. [[GNU]] {{mono|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.<ref>{{cite web | url = https://ftp.gnu.org/old-gnu/Manuals/coreutils-4.5.4/html_node/coreutils_149.html | title = Why GNU su does not support the 'wheel' group | access-date = May 30, 2022 | url-status = live | archive-url = https://web.archive.org/web/20210621182110/https://ftp.gnu.org/old-gnu/Manuals/coreutils-4.5.4/html_node/coreutils_149.html | archive-date = June 21, 2021}}</ref> == See also == * [[Unix security]] * [[List of Unix commands]] * [[Comparison of privilege authorization features]] == Further reading == * {{Cite web |date=2013-01-14 |title=From Novice to Master, and Back Again |url=https://blog.djmnet.org/2013/01/14/from-novice-to-master-and-back-again/ |access-date=2022-08-10 |website=D-Mac's Stuff |language=en}} == References == {{Reflist}} == External links == * [https://web.archive.org/web/20131210155635/http://www.gnu.org/software/coreutils/manual/html_node/su-invocation.html su] β manual pages from [[GNU]] [[coreutils]]. * '''{{man|1|su|die.net}}''' * {{man|1|su|FreeBSD}} * {{man|8|su|Solaris}} * [http://www.linfo.org/su.html The su command] β by The Linux Information Project (LINFO) ({{Webarchive |url=https://web.archive.org/web/20211020082958/http://www.linfo.org/su.html |date=20 October 2021}}) {{Unix commands}} [[Category:Unix user management and support-related utilities]] [[Category:System administration]] {{unix-stub}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cite tech report
(
edit
)
Template:Cite web
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Lowercase title
(
edit
)
Template:Main other
(
edit
)
Template:Man
(
edit
)
Template:Mono
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Template other
(
edit
)
Template:Unix-stub
(
edit
)
Template:Unix commands
(
edit
)
Template:Webarchive
(
edit
)