`

centos 权限

 
阅读更多
环境:VMware下的CentOS
操作:
[shaon@localhost ~]$ sudo apt-get install samba   <-----普通用户shaokn要进行sudo操作
[sudo] password for shaokn:            <-----input passwd
shaokn is not in the sudoers file. This incident will be reported.
提示用户shaokn不在sudoers文件里.我们要做的就是把shaokn用户添加到sudoers文件里,怎么做呢?
 
1.进入超级用户模式.
[shaon@localhost ~]$ su -     
Password:                   <-----input passwd 
[root@localhost ~]#         <-----root超级用户
 
2.添加sudoers文件写权限. 
[root@localhost ~]chmod u+w /etc/sudoers  <-----注意sudoers文件路径
 
3.添加shaokn到sudoers文件里. 在"root ALL=(ALL) ALL"这行下添加"shaokn ALL=(ALL) ALL".
[root@localhost ~]# vim /etc/sudoers
.........................
.........................
root    ALL=(ALL)   ALL
shaokn  ALL=(ALL)   ALL   <-----添加到这里. :wq保存退出
.........................
.........................
 
4.撤消sudoers写权限. 记得撤消写权限.
[root@localhost ~]chmod u-w /etc/sudoers

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics