Linux - sudo
sudo
[toc]
sudo file
Sudo
is a program that allows users to run programs, on behalf of another user, typically, the super user or root.
sudo file
: specifies how sudo access is granted for a given user.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
visudo # a privilege process
#
# 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:/s$
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
# usrname, host=(the usrname can be), commands can be run
root ALL=(ALL:ALL) ALL
bob ALL=(ALL:ALL) ALL # use [TAB]
hanbin ALL=NOPASSWD: /sbin/fdisk # no ask passwd for access this file
# 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
control+O, save it
show all the sudo commands
typed
sudo tail -3 /var/log/secure
.
This post is licensed under CC BY 4.0 by the author.
Comments powered by Disqus.