Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

sudo

From Wikipedia, the free encyclopedia
Command on Unix systems to temporarily assume root privileges
"SUDO" redirects here. For the non-profit organization, seeSudan Social Development Organization. For other uses, seeSudo (disambiguation).
sudo
Thesudo command in a terminal
Original authorsRobert Coggeshall, Cliff Spencer
DeveloperTodd C. Miller
Initial releasec. 1980[1]
Stable release
1.9.17p2 Edit this on Wikidata[2] / 26 July 2025; 6 months ago (26 July 2025)
Written inC
Operating systemUnix-like
TypePrivilege authorization
LicenseISC-style[3]
Websitewww.sudo.wsEdit this at Wikidata
Repository

sudo (/sd/ or/ˈsd/[4]) is ashellcommand onUnix-likeoperating systems that enables a user to run a program with the security privileges of another user, by default thesuperuser.[5] It originally stood for "superuser do",[6] as that was all it did, and this remains its most common usage;[7] however, the official Sudo project page lists it as "su 'do'".[8] The current Linux manual pages definesu as "substitute user",[9] making the modern meaning ofsudo "substitute user, do", becausesudo can run a command as other users as well.[10][11]

Unlike the similar commandsu, users must, by default, supply their ownpassword for authentication, rather than the password of the target user. After authentication, and if theconfiguration file (typically/etc/sudoers) permits the user access, the system invokes the requested command. The configuration file offers detailed access permissions, including enabling commands only from the invoking terminal; requiring a password per user or group; requiring re-entry of a password every time or never requiring a password at all for a particular command line. It can also be configured to permit passing arguments or multiple commands.

History

[edit]

Robert Coggeshall andCliff Spencer wrote the original subsystem around 1980 at the Department of Computer Science atSUNY/Buffalo.[12] Robert Coggeshall brought sudo with him to theUniversity of Colorado Boulder. Between 1986 and 1993, the code and features were substantially modified by the IT staff of theUniversity of Colorado Boulder Computer Science Department and the College of Engineering and Applied Science, including Todd C. Miller.[12] The current version has been publicly maintained byOpenBSD developer Todd C. Miller since 1994,[12] and has been distributed under anISC-style license since 1999.[12]

In November 2009, Thomas Claburn, in response to concerns thatMicrosoft had patented sudo,[13] characterized such suspicions as overblown.[14] Theclaims were narrowly framed to a particularGUI, rather than to the sudo concept.[15]

The logo is a reference to anxkcd strip, where an order for a sandwich is accepted only when preceded withsudo.[16][17]

Design

[edit]
We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: 1: Respect the privacy of others. 2: Think before you type. 3: With great power comes great responsibility. root's password:
Warning when first usingsudo

Unlike forsu, users supply their personal password tosudo (if necessary)[18] rather than that of the superuser or other account. This allows authorized users to exercise altered privileges without compromising the secrecy of the other account's password.[19] Users must be in a certaingroup to use thesudo command, typically either thewheel orsudo group.[20] After authentication, and if the configuration file permits the user access, the system invokes the requested command.sudo retains the user's invocation rights through a grace period (typically 5 minutes) perpseudo terminal, allowing the user to execute several successive commands as the requested user without having to provide a password again.[21]

As a security and auditing feature,sudo may be configured to log each command run. When a user attempts to invokesudo without being listed in the configuration file, an exception indication is presented to the user indicating that the attempt has been recorded. If configured, the root user will be alerted viamail. By default, an entry is recorded in the system.[22]

Configuration

[edit]

The/etc/sudoers file contains a list of users or user groups with permission to execute a subset of commands while having the privileges of theroot user or another specified user. The file can be edited by using the commandsudo visudo. Sudo contains several configuration options such as allowing commands to be run assudo without a password, changing which users can usesudo, and changing the message displayed upon entering an incorrect password.[23] Sudo features aneaster egg that can be enabled from the configuration file that will display an insult every time an incorrect password is entered.[24]

Impact

[edit]

In some system distributions,sudo has largely supplanted the default use of a distinct superuser login for administrative tasks, most notably in someLinux distributions as well as Apple'smacOS.[25][26] This allows for more secure logging of admin commands and prevents some exploits.

RBAC

[edit]
Main article:Role-based access control

In association withSELinux,sudo can be used to transition between roles inrole-based access control (RBAC).[27]

Tools and similar programs

[edit]

visudo is a command-line utility that allows editing the sudo configuration file in a fail-safe manner. It prevents multiple simultaneous edits withlocks and performssanity and syntax checks.

Sudoedit is a program that symlinks to the sudo binary.[28] When sudo is run via its sudoedit alias, sudo behaves as if the -e flag has been passed and allows users to edit files that require additional privileges to write to.[29]

Microsoft released its own tool also calledsudo forWindows in February 2024. Its interface is similar to its Unix counterpart by giving the ability to run elevated commands from an unelevated console session, although its implementation is entirely different.[30] The programrunas provides comparable functionality in Windows, but it cannot pass current directories, environment variables or long command lines to the child. And while it supports running the child as another user, it does not support simple elevation.Hamilton C shell also includes truesu andsudo for Windows that can pass all of that state information and start the child either elevated or as another user (or both).[31][32]

Graphical user interfaces exist for sudo – notablygksudo – but are deprecated inDebian and no longer included inUbuntu.[33][34] Other user interfaces are not directly built on sudo, but provide similar temporary privilege elevation for administrative purposes, such aspkexec in Unix-like operating systems,User Account Control inMicrosoft Windows andMac OS X Authorization Services.[35]

doas, available sinceOpenBSD 5.8 (October 2015), has been written in order to replacesudo in theOpenBSD base system, with the latter still being made available as aport.[36]

gosu is a tool similar to sudo that is popular in containers where the terminal may not be fully functional or where there are undesirable effects from running sudo in a containerized environment.[37]

A rewrite of sudo, called sudo-rs, written in theRust programming language, became adopted as the default inUbuntu.[38]

See also

[edit]

References

[edit]
  1. ^Miller, Todd C."A Brief History of Sudo".Archived from the original on 16 November 2018. Retrieved15 November 2018.
  2. ^"Sudo News".Archived from the original on 1 December 2021. Retrieved12 April 2023.
  3. ^Todd C. Miller (2011-06-17)."Sudo License". sudo.ws.Archived from the original on 2015-07-31. Retrieved2011-11-17.
  4. ^Miller, Todd C."Troubleshooting tips and FAQ for Sudo".Archived from the original on 2021-11-27. Retrieved2009-11-20.
  5. ^Cohen, Noam (May 26, 2008)."This Is Funny Only if You Know Unix".The New York Times.Archived from the original on January 22, 2018. RetrievedApril 9, 2012.
  6. ^By (2014-05-28)."Interview: Inventing The Unix "sudo" Command".Hackaday.Archived from the original on 2022-01-10. Retrieved2022-01-10.
  7. ^"Aaron Toponce : The Meaning of 'su'". Archived fromthe original on 2023-02-24. Retrieved2015-08-18.
  8. ^"What is Sudo".Archived from the original on 2022-06-03. Retrieved2022-06-07.
  9. ^"su(1) Linux manual page".Archived from the original on 2022-06-05. Retrieved2022-06-08.
  10. ^"Sudo - ArchWiki"(MediaWiki).wiki.archlinux.org.Archived from the original on 2021-04-25. Retrieved2015-11-09.
  11. ^Haeder, A.; Schneiter, S. A..; Pessanha, B. G.; Stanger, J.LPI Linux Certification in a Nutshell. O'Reilly Media, 2010. p. 409.ISBN 978-0596804879.
  12. ^abcdMiller, Todd C."A Brief History of Sudo".Archived from the original on 2021-01-27. Retrieved2021-02-08.
  13. ^Lilly, Paul."Microsoft has Patented "sudo." Yes, the Command". Archived fromthe original on 2014-07-01. Retrieved2009-11-13.
  14. ^"Does New Microsoft Patent Infringe On Unix Program Sudo? Some in the open source community suspicious of Microsoft's intent".Dark Reading. 2009-11-16.Archived from the original on 2022-08-20. Retrieved2022-05-27.A patent granted to Microsoft (NSDQ: MSFT) has stirred up worry that world's largest software company wants to claim Unix's "sudo" as its own. [...] In short, suspicions about this patent are overblown.
  15. ^Eaton, Nick (November 12, 2009)."Did Microsoft just sneakily patent an open-source tool?". seattlepi.com. Archived fromthe original on 2021-06-20. RetrievedApril 24, 2011.
  16. ^"Sandwich".Archived from the original on 2022-04-09. Retrieved2022-04-11.
  17. ^"Sudo Logo".Archived from the original on 2022-04-27. Retrieved2022-04-11.
  18. ^"About Unix sudo and su commands".University Information Technology Services. June 18, 2019.Archived from the original on September 10, 2022. RetrievedSeptember 10, 2022.
  19. ^Wallen, Jack (2023-05-16)."Linux security: What is sudo and why is it so important?".ZDNET. Retrieved2024-01-23.
  20. ^Aleksic, Marko (2020-08-18)."Linux Sudo Command, How to Use With Examples".Knowledge Base by phoenixNAP. Retrieved2024-01-23.
  21. ^Sheldon, Robert (February 2023)."What is the sudo (su 'do') command-line utility? – TechTarget Definition".TechTarget Security. Retrieved2024-01-23.
  22. ^Where are sudo Incidents Reported?Archived 2023-04-09 at theWayback Machine Retrieved April 10, 2023
  23. ^Wallen, Jack (2010-05-12)."Linux 101: Introduction to sudo".Linux.com. Retrieved2024-01-23.
  24. ^Kili, Aaron (2017-01-12)."Let Sudo Insult You When You Enter Incorrect Password".www.tecmint.com. Retrieved2024-01-23.
  25. ^"RootSudo".Community Ubuntu Documentation. help.ubuntu.com. 2011-11-08.Archived from the original on 2011-11-05. Retrieved2011-11-17.
  26. ^"Top Ten Mac OS X Tips for Unix Geeks". MacDevCenter.com. Archived fromthe original on 2012-10-15. Retrieved2022-05-27.
  27. ^"SELinux Lockdown Part Five: SELinux RBAC".Archived from the original on 2013-05-11. Retrieved2012-11-17.
  28. ^Bennett, Jonathan (2021-01-29)."This Week In Security: Sudo, Database Breaches, And Ransomware".Hackaday.Archived from the original on 2021-06-21. Retrieved2021-05-24.
  29. ^"sudoedit(8) - Linux manual page".man7.org.Archived from the original on 2021-05-24. Retrieved2021-05-24.
  30. ^Adoumie, Jordi (2024-02-07)."Introducing Sudo for Windows!".Windows Command Line. Retrieved2024-02-08.
  31. ^"su". Hamilton Laboratories.Archived from the original on July 17, 2015. RetrievedAugust 17, 2015.
  32. ^"Predefined aliases: sudo". Hamilton Laboratories.Archived from the original on August 26, 2015. RetrievedAugust 17, 2015.
  33. ^Bicha, Jeremy (December 30, 2017)."Remove gksu from Ubuntu".Canonical, which ownsLaunchpad.Archived from the original on May 5, 2020. RetrievedJanuary 10, 2020.
  34. ^"Software Packages in "bionic"".Canonical.Archived from the original on October 18, 2019. RetrievedJanuary 10, 2020.
  35. ^"Introduction to Authorization Services Programming Guide". developer.apple.com.Archived from the original on 2022-05-28. Retrieved2022-05-27.
  36. ^"sudo-1.8.26 – execute a command as another user".OpenBSD ports. 2018-11-16.Archived from the original on 2019-02-27. Retrieved2019-02-26.
  37. ^"gosu".GitHub.
  38. ^"Memory-safe sudo to become the default in Ubuntu". 2025-06-05.

External links

[edit]
File system
Processes
User environment
Text processing
Shell builtins
Searching
Documentation
Software development
Miscellaneous
TheOpenBSD Project
Operating system
Related projects
People
Organizations
Publications
Retrieved from "https://en.wikipedia.org/w/index.php?title=Sudo&oldid=1329727956"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp