The
Unix
Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user 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, a ...
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
Science Biology
* Seashell, a hard outer layer of a marine ani ...
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
In computing, the superuser is a special user account used for system administration. Depending on the operating system (OS), the actual name of this account might be root, administrator, admin or supervisor. In some cases, the actual name of the ...
account (user id 0) of the system.
History
The command , including the
Unix permissions system and the
setuid
The Unix and Linux 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 chang ...
system call, was part of
Version 1 Unix. Encrypted passwords appeared in
Version 3.
The command is available as a separate package for
Microsoft Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
as part of the
UnxUtils
UnxUtils is a collection of utility programs that provide popular Unix-based shell commands ported from GNU implementations as native Windows programs that depend only on Win32 and the Microsoft C- runtime ( msvcrt.dll). The collection wa ...
collection of
native
Native may refer to:
People
* '' Jus sanguinis'', nationality by blood
* '' Jus soli'', nationality by location of birth
* Indigenous peoples, peoples with a set of specific rights based on their historical ties to a particular territory
** Nat ...
Win32
The Windows API, informally WinAPI, is the foundational application programming interface (API) that allows a computer program to access the features of the Microsoft Windows operating system in which the program is running. Programs can acces ...
ports Ports collections (or ports trees, or just ports) are the sets of makefiles and Patch (Unix), patches provided by the BSD-based operating systems, FreeBSD, NetBSD, and OpenBSD, as a simple method of installing software or creating binary packages. T ...
of common GNU Unix-like utilities.
The command was removed from
GNU coreutils
The GNU Core Utilities or coreutils is a collection of GNU software that implements many standard, Unix-based shell commands. The utilities generally provide POSIX compliant interface when the environment variable is set, but otherwise offers a ...
as of release 8.18 (2012-08-12) and is currently included in the
util-linux
is a package of utilities distributed by the Linux Kernel Organization for use in a Linux operating system. A fork, (with meaning "next generation"), was created when development stalled, but has been renamed back to , and is the official ve ...
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.
The hyphen is sometimes confused with dashes (en dash , em dash and others), which are wider, or with t ...
() 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 a shell (computing), shell command (computing), command on Unix-like operating systems that enables a user to run a program with the security privileges of another user, by default the superuser. It originally stood for "superuser do", a ...
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, *nix 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 Uni ...
systems implement the user group ''
wheel
A wheel is a rotating component (typically circular in shape) that is intended to turn on an axle Bearing (mechanical), bearing. The wheel is one of the key components of the wheel and axle which is one of the Simple machine, six simple machin ...
'', 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 (394 packages ), 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 operating systems popu ...
, 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.
Design concepts
Permissions
A core security feature in these systems is the file system permissions. All files in a typical Unix filesystem have permissions set ...
*
List of Unix commands
This is a list of the shell commands of the most recent version of the Portable Operating System Interface (POSIX) IEEE Std 1003.1-2024 which is part of the Single UNIX Specification (SUS). These commands are implemented in many shells on moder ...
*
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, Microsoft Windows, Wind ...
Further reading
*
References
External links
sunbsp;– manual pages from
GNU
GNU ( ) is an extensive collection of free software (394 packages ), 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 operating systems popu ...
coreutils
The GNU Core Utilities or coreutils is a collection of GNU software that implements many standard, Unix-based shell commands. The utilities generally provide POSIX compliant interface when the environment variable is set, but otherwise offers ...
.
*
*
*
The su commandnbsp;– by The Linux Information Project (LINFO) ()
Unix user management and support-related utilities
System administration
{{unix-stub