1) 添加一个用户
1. # useradd windriver
2. # passwd windriver
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Retype new UNIX password:
passwd: password updated successfully
2) 将用户加入sudoers
1. # ls -all /etc/sudoers
-r--r----- 1 root root 744
6月
8 10:29 /etc/sudoers
2. # chmod 640 /etc/sudoers
3. # vi /etc/sudoers
3. # vi /etc/sudoers
4. 在root ALL=(ALL:ALL) ALL 下添加一行 for user windriver
windriver ALL=(ALL) ALL
第一个all指网络中的主机
第二个all指用户
第三个all指命令
:wq
5. # chmod 440 /etc/sudoers
6. # su windriver
3)用户使用sudo命令不输入密码
1. # chmod 640 /etc/sudoers
2. # vim /etc/sudoers
3. 在行%sudo ALL=(ALL:ALL) ALL之下添加如下行,使用户windriver使用sudo命令不必输入密码:
windriver ALL=(ALL) NOPASSWD: ALL
windriver ALL=(ALL) NOPASSWD: ALL
:wq
4. # chmod 440 /etc/sudoers