Linux实验 -5 sudo

68 阅读1分钟

进入方式

visudo

{C3E7576E-E6FA-4A0C-B44D-23D7ED465E2A}.png

##
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL

## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS

## Allows people in group wheel to run all commands
%wheel  ALL=(ALL)       ALL

## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL

## Allows members of the users group to mount and unmount the
## cdrom as root
# %users  ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom

## Allows members of the users group to shutdown this system
# %users  localhost=/sbin/shutdown -h now

## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d

我们可以创建一个艾伦用户

[root@localhost sbin]# useradd ailun
[root@localhost sbin]# passwd ailun 
更改用户 ailun 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@localhost sbin]# su ailun

在visudo中添加

{52636176-E63C-45BB-A604-A6ECCB65E769}.png

此时ailun就有了超级管理员权限