Difference between revisions of "Sudo"

From wikieduonline
Jump to navigation Jump to search
 
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
== Examples ==
 
== Examples ==
 
* Add user to sudo [[group]]: <code>sudo [[usermod]] '''-a'''G sudo YOUR_USERNAME</code>
 
* Add user to sudo [[group]]: <code>sudo [[usermod]] '''-a'''G sudo YOUR_USERNAME</code>
 +
* <code>[[sudo -u postgres psql]]</code>
  
 
== Task ==
 
== Task ==
Line 30: Line 31:
 
== Options ==
 
== Options ==
 
* <code>-S, --[[stdin]]</code>
 
* <code>-S, --[[stdin]]</code>
 +
* <code>[[-u]]</code>
  
 
== Related terms ==
 
== Related terms ==
Line 36: Line 38:
 
* <code>[[become_method]]</code>
 
* <code>[[become_method]]</code>
 
* <code>[[SET SESSION AUTHORIZATION]]</code>
 
* <code>[[SET SESSION AUTHORIZATION]]</code>
 +
* [[gosu]]
 +
* [[kubectl]] [[--as]]
  
 
== See also ==
 
== See also ==

Latest revision as of 09:26, 2 November 2023

sudo (1980s) is a program for Unix-like computer operating systems that allows users to run programs with the security privileges of another user.

Examples[edit]

Task[edit]

  • Allow user YOUR_USER_NAME to run sudo commands without typing the password:

Include in /etc/sudoers, using the visudo command, the following line at the end of the file:

YOUR_USER_NAME ALL=(ALL) NOPASSWD:ALL[1]

Security vulnerabilities[edit]

Exploitable if the following configuration is present:

username hostname = (ALL, !root) path-to-command

Errors[edit]

sudo: unable to resolve host
See: resolv.conf
[sudo] password for USERNAME:
USERNAME is not in the sudoers file.  This incident will be reported.

Options[edit]

Related terms[edit]

See also[edit]

  • https://askubuntu.com/questions/192050/how-to-run-sudo-command-with-no-password
  • Advertising: