Su (Unix)

Revision as of 00:08, 21 May 2025 by imported>Anthony2106 (I think we are meant to use double quotes)
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Template:Short description Template:Lowercase title {{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1 | unknown = Template:Main other | preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y | AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid }}Template:Main other The Unix command Template:Mono, which stands for "substitute user"<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> (or historically "superuser"<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>), 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.

HistoryEdit

The command Template:Mono, including the Unix permissions system and the setuid system call, was part of Version 1 Unix. Encrypted passwords appeared in Version 3.<ref name="reader">Template:Cite tech report</ref> The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

The Template:Mono command was removed from GNU coreutils as of release 8.18 (2012-08-12)<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> and is currently included in the util-linux package.

UsageEdit

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 (Template:Mono) 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 Template:Mono, best editable by the command Template:Mono). Unlike Template:Mono, Template:Mono 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 Template:Mono.<ref name=levi>Template:Cite book</ref> This may or may not mitigate these security concerns, since an intruder might first simply break into one of those accounts. GNU Template:Mono, 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>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

See alsoEdit

Further readingEdit

  • {{#invoke:citation/CS1|citation

|CitationClass=web }}

ReferencesEdit

Template:Reflist

External linksEdit

Template:Unix commands

Template:Unix-stub