当前位置:   article > 正文

centos is not in the sudoers file问题

centos is not in the sudoers

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

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/834736
推荐阅读
相关标签
  

闽ICP备14008679号