sudo

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

sudo
Original author(s)Robert Coggeshall, Cliff Spencer
Developer(s)Todd C. Miller
Initial releaseAround 1980[1]
Stable release
1.9.14p3 Edit this on Wikidata[2] / 25 July 2023 (25 July 2023)
Repository
Written inC
Operating systemUnix-like
TypePrivilege authorization
LicenseISC-style[3]
Websitewww.sudo.ws

Unlike the similar command su, users must, by default, supply their own password for authentication, rather than the password of the target user. After authentication, and if the configuration 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

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

In November 2009 Thomas Claburn, in response to concerns that Microsoft had patented sudo,[14] characterized such suspicions as overblown.[15] The claims were narrowly framed to a particular GUI, rather than to the sudo concept.[16]

The logo is a reference to an xkcd strip.[17][18]

Design

Unlike the command su, users supply their personal password to sudo (if necessary)[19] 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. 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) per pseudo terminal, allowing the user to execute several successive commands as the requested user without having to provide a password again.

As a security and auditing feature, sudo may be configured to log each command run. When a user attempts to invoke sudo 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 via mail. By default, an entry is recorded in the system.[20]

Configuration

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 the root user or another specified user. The program may be configured to require a password.[21]

Impact

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

RBAC

In association with SELinux, sudo can be used to transition between roles in role-based access control (RBAC).[24]

Tools and similar programs

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

Sudoedit is a program that symlinks to the sudo binary.[25] 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.[26]

The program runas provides similar functionality in Microsoft 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. A true su and sudo for Windows that can pass all of that state information and start the child either elevated or as another user (or both) is included with Hamilton C shell.[27][28]

Graphical user interfaces exist for sudo – notably gksudo – but are deprecated in Debian and no longer included in Ubuntu.[29][30] Other user interfaces are not directly built on sudo, but provide similar temporary privilege elevation for administrative purposes, such as pkexec in Unix-like operating systems, User Account Control in Microsoft Windows and Mac OS X Authorization Services.[31]

doas, available since OpenBSD 5.8 (October 2015), has been written in order to replace sudo in the OpenBSD base system, with the latter still being made available as a port.[32]

See also

References

  1. Miller, Todd C. "A Brief History of Sudo". Archived from the original on 16 November 2018. Retrieved 15 November 2018.
  2. "Sudo News". Archived from the original on 1 December 2021. Retrieved 12 April 2023.
  3. Todd C. Miller (2011-06-17). "Sudo License". sudo.ws. Archived from the original on 2015-07-31. Retrieved 2011-11-17.
  4. Miller, Todd C. "Troubleshooting tips and FAQ for Sudo". Archived from the original on 2021-11-27. Retrieved 2009-11-20.
  5. "How do YOU pronounce "sudo"?". Ars Technica. 18 June 2008. Archived from the original on 3 September 2017. Retrieved 15 June 2017.
  6. 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. Retrieved April 9, 2012.
  7. By (2014-05-28). "Interview: Inventing The Unix "sudo" Command". Hackaday. Archived from the original on 2022-01-10. Retrieved 2022-01-10.
  8. "Aaron Toponce : The Meaning of 'su'". Archived from the original on 2023-02-24. Retrieved 2015-08-18.
  9. "What is Sudo". Archived from the original on 2022-06-03. Retrieved 2022-06-07.
  10. "su(1) Linux manual page". Archived from the original on 2022-06-05. Retrieved 2022-06-08.
  11. "Sudo - ArchWiki" (MediaWiki). wiki.archlinux.org. Archived from the original on 2021-04-25. Retrieved 2015-11-09.
  12. 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.
  13. Miller, Todd C. "A Brief History of Sudo". Archived from the original on 2021-01-27. Retrieved 2021-02-08.
  14. Lilly, Paul. "Microsoft has Patented "sudo." Yes, the Command". Archived from the original on 2014-07-01. Retrieved 2009-11-13.
  15. "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. Retrieved 2022-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.
  16. Eaton, Nick (November 12, 2009). "Did Microsoft just sneakily patent an open-source tool?". seattlepi.com. Archived from the original on 2021-06-20. Retrieved April 24, 2011.
  17. "Sandwich". Archived from the original on 2022-04-09. Retrieved 2022-04-11.
  18. "Sudo Logo". Archived from the original on 2022-04-27. Retrieved 2022-04-11.
  19. "About Unix sudo and su commands". University Information Technology Services. June 18, 2019. Archived from the original on September 10, 2022. Retrieved September 10, 2022.
  20. https://www.baeldung.com/linux/sudo-incident-logs Archived 2023-04-09 at the Wayback Machine Retrieved April 10, 2023
  21. "Sudo Manual". Archived from the original on 2021-01-21. Retrieved 2021-02-08.
  22. "RootSudo". Community Ubuntu Documentation. help.ubuntu.com. 2011-11-08. Archived from the original on 2011-11-05. Retrieved 2011-11-17.
  23. "Top Ten Mac OS X Tips for Unix Geeks". MacDevCenter.com. Archived from the original on 2012-10-15. Retrieved 2022-05-27.
  24. "SELinux Lockdown Part Five: SELinux RBAC". Archived from the original on 2013-05-11. Retrieved 2012-11-17.
  25. Bennett, Jonathan (2021-01-29). "This Week In Security: Sudo, Database Breaches, And Ransomware". Hackaday. Archived from the original on 2021-06-21. Retrieved 2021-05-24.
  26. "sudoedit(8) - Linux manual page". man7.org. Archived from the original on 2021-05-24. Retrieved 2021-05-24.
  27. "su". Hamilton Laboratories. Archived from the original on July 17, 2015. Retrieved August 17, 2015.
  28. "Predefined aliases: sudo". Hamilton Laboratories. Archived from the original on August 26, 2015. Retrieved August 17, 2015.
  29. Bicha, Jeremy (December 30, 2017). "Remove gksu from Ubuntu". Canonical, which owns Launchpad. Archived from the original on May 5, 2020. Retrieved January 10, 2020.
  30. "Software Packages in "bionic"". Canonical. Archived from the original on October 18, 2019. Retrieved January 10, 2020.
  31. "Introduction to Authorization Services Programming Guide". developer.apple.com. Archived from the original on 2022-05-28. Retrieved 2022-05-27.
  32. "sudo-1.8.26 – execute a command as another user". OpenBSD ports. 2018-11-16. Archived from the original on 2019-02-27. Retrieved 2019-02-26.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.