赞
踩
在centos用户下使用sudo + 命令时,报异常“centos is not in the sudoers file”
注:centos为本机用户名,因人而异!
原因:当前的centos用户名没有在/etc/sudoers文件中注册!
解决办法:
1.配置sudoers文件
1)切换到root用户
su root
2)进入sudoers目录
cd /etc
3)增加sudoers文件的写入权限
chmod u+w sudoers
4)编辑sudoers文件
vim sudoers
在root ALL=(ALL) ALL这一行下面,添加:
centos ALL=(ALL) ALL
注:其中centos为本机的用户名,因人而异!
2.恢复sudoers文件的权限
chmod u-w sudoers
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。