码迷,mamicode.com
首页 > 系统相关 > 详细

【Ubuntu 14.04】*** is not in the sudoers file

时间:2015-07-08 00:49:00      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:ubuntu 14.04 sudo sudoers

junq@wode008:~$ sudo /opt/script/ntp.date.sh 

[sudo] password for junq: 

Sorry, try again.

[sudo] password for junq: 

junq is not in the sudoers file.  This incident will be reported.

junq@wode008:~$ 


***是你当前的用户名,原因是***用户没有加入到sudo的配置文件里


// 查看sudo user

root@wode008:/etc/sudoers.d# ls -al /etc/sudoers

-r--r----- 1 root root 745 Feb 11  2014 /etc/sudoers

root@wode008:/etc/sudoers.d# 


// 给予写权限

root@wode008:/etc/sudoers.d# chmod a+w /etc/sudoers

root@wode008:/etc/sudoers.d# ls -al /etc/sudoers

-rw-rw--w- 1 root root 745 Feb 11  2014 /etc/sudoers

root@wode008:/etc/sudoers.d# 


// 修改内容

root@wode008:/etc/sudoers.d# vi /etc/sudoers

root@wode008:/etc/sudoers.d# 


# User privilege specification

root    ALL=(ALL:ALL) ALL


# Members of the admin group may gain root privileges

%admin ALL=(ALL) ALL

junq ALL=(ALL) ALL


# Allow members of group sudo to execute any command

%sudo   ALL=(ALL:ALL) ALL


// 去掉写权限

root@wode008:/etc/sudoers.d# ls -al /etc/sudoers

-rw-rw--w- 1 root root 764 Jul  7 20:52 /etc/sudoers

root@wode008:/etc/sudoers.d# chmod a-w /etc/sudoers

root@wode008:/etc/sudoers.d# ls -al /etc/sudoers

-r--r----- 1 root root 764 Jul  7 20:52 /etc/sudoers

root@wode008:/etc/sudoers.d# 


// 普通用户,以sudo执行

junq@wode008:~$ sudo /opt/script/ntp.date.sh 

[sudo] password for junq: 

 7 Jul 20:53:42 ntpdate[9784]: step time server 202.118.1.81 offset -0.681162 sec

 7 Jul 20:53:49 ntpdate[9785]: adjust time server 128.138.141.172 offset -0.014033 sec

junq@wode008:~$


【Ubuntu 14.04】*** is not in the sudoers file

标签:ubuntu 14.04 sudo sudoers

原文地址:http://huangchao.blog.51cto.com/10446378/1671816

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!