linux给用户添加sudo权限

本人用的是ubuntukylin13.10。刚才想用早上新添加的用户vinci来新增加用户,提示没有sudo权限:

vinci@flymouse-pc:~$ sudo useradd test
[sudo] password for vinci: 
vinci is not in the sudoers file. This incident will be reported.


有时候,linux下面运行sudo命令,会提示类似: 
xxx is not in the sudoers file.  This incident will be reported.
这里,xxx是用户名称,然后导致无法执行sudo命令,这时候,如下解决:


1.进入超级用户模式。也就是输入"su -",系统会让你输入超级用户密码,输入密码后就进入了超级用户模式。

2.添加文件的写权限。使用以下命令:

root@flymouse-pc:~# chmod u+w /etc/sudoers

3.编辑/etc/sudoers文件。使用以下命令:

root@flymouse-pc:~# gedit /etc/sudoers

找到这一 行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(这里的xxx是你的用户名,我是vinci),然后保存退出。

# User privilege specification
root    ALL=(ALL:ALL) ALL
vinci   ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges

4.撤销文件的写权限。使用以下命令:

root@flymouse-pc:~# chmod u-w /etc/sudoers




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值