[~]# adduser XXX
[~]# passwd XXX
Changing password for user XXX.
New password:
BAD PASSWORD: The password is shorter than 7 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[~]# whereis sudoers
sudoers: /etc/sudoers /etc/sudoers.d /usr/libexec/sudoers.so /usr/share/man/man5/sudoers.5.gz
[~]# ls -l /etc/sudoers
-r--r----- 1 root root 3925 Sep 25 00:13 /etc/sudoers
[~]# chmod -v u+w /etc/sudoers
mode of ‘/etc/sudoers’ changed from 0440 (r--r-----) to 0640 (rw-r-----)
[~]# vim /etc/sudoers
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
XXX ALL=(ALL) ALL
[~]# chmod -v u-w /etc/sudoers
mode of ‘/etc/sudoers’ changed from 0640 (rw-r-----) to 0440 (r--r-----)
使用新用户登陆,提示已拥有权限,且需要输入密码才能进行下一步。
$ sudo cat /etc/passwd
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for XXX: