xxx is not in the sudoers file---ubuntu系统普通用户执行sudo命令提示错误

版权声明:可以转载,请标明作者和来源。原创首发http://kakazai.cn https://blog.csdn.net/yeziand01/article/details/88376995

文章目录

问题

  • ubuntu系统,新创建的普通用户,执行sudo命令,出现错误提示
hadoop1@iZwz97y9f1fb0ymlzbdsv0Z:~$ sudo apt-get install ssh
[sudo] password for hadoop1:
hadoop1 is not in the sudoers file.  This incident will be reported.

原因

新建的普通用户没有sudo权限,要为其增加sudo权限。

解决方案

  • 切换到root账户:su - root,执行命令:visudo,在打开的文件中修改内容如下:
# User privilege specification
root     ALL=(ALL:ALL) ALL	#原有行
hadoop1  ALL=(ALL:ALL) ALL  #新增hadoop1用户
hadoop2  ALL=(ALL:ALL) ALL  #新增hadoop2用户
  • visudo命令,默认是使用nano编辑器,所以保存退出的时候需要通过快捷键的方式来完成
    修改完后,保存:Ctrl+O
    执行完“Ctrl+O”后,会输出”File Name to Write sudoers.tmp”,输入回车键
    再退出:Ctrl+X

猜你喜欢

转载自blog.csdn.net/yeziand01/article/details/88376995