Difference between revisions of "Sudo command"

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to navigation Jump to search
(Created page with "The '''sudo''' command allows a permitted user to run a command as the superuser (root) or another user as set by the security policy of the system. All security policies are...")
 
 
Line 38: Line 38:
 
#includedir /etc/sudoers.d
 
#includedir /etc/sudoers.d
 
</pre>
 
</pre>
 +
 +
== See also ==
 +
* [https://www.cyberciti.biz/faq/how-to-create-a-sudo-user-on-ubuntu-linux-server/ How to create a new sudo user on Ubuntu Linux server]
 +
* [https://www.cyberciti.biz/faq/linux-unix-running-sudo-command-without-a-password/ How to run sudo command without a password on a Linux or Unix]
 +
* [https://www.cyberciti.biz/faq/how-to-add-delete-grant-sudo-privileges-to-users-on-freebsd-unix-server/ How To Add, Delete, and Grant Sudo Privileges to Users on a FreeBSD Server]
 +
* [https://www.cyberciti.biz/faq/sudo-append-data-text-to-file-on-linux-unix-macos/ How to append text to a file when using sudo command on Linux or Unix]
 +
* [https://www.cyberciti.biz/faq/how-to-run-multiple-commands-in-sudo-under-linux-or-unix/ How to run multiple commands in sudo under Linux or Unix]
 +
* [https://www.cyberciti.biz/faq/freebsd-install-sudo-command/ FreeBSD: Install sudo Command To Execute A Command As The Root]

Latest revision as of 17:00, 21 November 2017

The sudo command allows a permitted user to run a command as the superuser (root) or another user as set by the security policy of the system. All security policies are defined in /etc/sudoers file or /etc/sudoers.d/ directory.

Default /etc/sudoers file

Use the cat command to view the default file:

sudo cat /etc/sudoers

Sample outputs:

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults	env_reset
Defaults	mail_badpass
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
Defaults	insults

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root	ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo	ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

See also