The
Unix
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, an ...
command , which stands for 'substitute user' (or historically 'superuser'), is used by a computer user to execute commands with the privileges of another user account. When executed it invokes a
shell
Shell may refer to:
Architecture and design
* Shell (structure), a thin structure
** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses
** Thin-shell structure
Science Biology
* Seashell, a hard o ...
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
A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
, it defaults to using the
superuser account (user id 0) of the system.
History
The command , including the
Unix permissions
Most file systems include attributes of files and directories that control the ability of users to read, change, navigate, and execute the contents of the file system. In some cases, menu options or functions may be made visible or hidden dependin ...
system and the
setuid
The Unix access rights flags setuid and setgid (short for ''set user identity'' and ''set group identity'') allow users to run an executable with the file system permissions of the executable's owner or group respectively and to change behaviour ...
system call, was part of
Version 1 Unix
The term "Research Unix" refers to early versions of the Unix operating system for DEC PDP-7, PDP-11, VAX and Interdata 7/32 and 8/32 computers, developed in the Bell Labs Computing Sciences Research Center (CSRC).
History
The term ''Resear ...
. Encrypted passwords appeared in
Version 3.
The command is available as a separate package for
Microsoft Windows as part of the
UnxUtils
UnxUtils is a collection of ports of common GNU Unix-like utilities to native Win32, with executables only depending on the Microsoft C- runtime msvcrt.dll. The collection was last updated externally on April 15, 2003, by Karl M. Syring. The mo ...
collection of
native
Native may refer to:
People
* Jus soli, citizenship by right of birth
* Indigenous peoples, peoples with a set of specific rights based on their historical ties to a particular territory
** Native Americans (disambiguation)
In arts and entert ...
Win32
The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
ports
A port is a maritime facility comprising one or more wharves or loading areas, where ships load and discharge cargo and passengers. Although usually situated on a sea coast or estuary, ports can also be found far inland, such as H ...
of common GNU Unix-like utilities.
The command was removed from
GNU coreutils
The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems.
In September 2002, the ''GNU coreutils'' were cr ...
as of release 8.18 (2012-08-12) and is currently included in the
util-linux
is a standard package distributed by the Linux Kernel Organization for use as part of the Linux operating system. A fork, (with meaning "next generation"), was created when development stalled, but has been renamed back to , and is the offi ...
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.
john@localhost:~$ su jane
Password:
jane@localhost:/home/john$ exit
logout
john@localhost:~$
When used with a
hyphen
The hyphen is a punctuation mark used to join words and to separate syllables of a single word. The use of hyphens is called hyphenation. ''Son-in-law'' is an example of a hyphenated word. The hyphen is sometimes confused with dashes ( figure ...
() 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 , best editable by the command ). Unlike , 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
A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
systems implement the user group ''
wheel'', and only allow members to become root with .
This may or may not mitigate these security concerns, since an intruder might first simply break into one of those accounts.
GNU
GNU () is an extensive collection of free software (383 packages as of January 2022), which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operat ...
, however, does not support the group ''wheel'' for philosophical reasons.
Richard Stallman
Richard Matthew Stallman (; born March 16, 1953), also known by his initials, rms, is an American free software movement activist and programmer. He campaigns for software to be distributed in such a manner that its users have the freedom to ...
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.
See also
*
Unix security
Unix security refers to the means of securing a Unix or Unix-like operating system. A secure environment is achieved not only by the design concepts of these operating systems, but also through vigilant user and administrative practices.
Design ...
*
List of Unix commands
This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems.
List
See also
* List of G ...
*
Comparison of privilege authorization features
A number of computer operating systems employ security features to help prevent malicious software from gaining sufficient privileges to compromise the computer system. Operating systems lacking such features, such as DOS, Windows implementations ...
Further reading
*
References
External links
sunbsp;– manual pages from
GNU
GNU () is an extensive collection of free software (383 packages as of January 2022), which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operat ...
coreutils
The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems.
In September 2002, the ''GNU coreutils'' were cr ...
.
*
*
*
The su commandnbsp;– by The Linux Information Project (LINFO) ()
Unix user management and support-related utilities
System administration
{{unix-stub