linux下普通用户无法使用sudo命令问题

  今天在新装的linux虚拟机中使用sudo命令时,报错如下

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

  

  解决方法:(在sudoers配置文件(/etc/sudoers)中加入需要用户配置即可)

  1.切换到root用户下

    终端中执行 su 命令,然后输入密码,从普通用户切换为根用户

   2.为sudoers配置文件添加写权限

    sudoers文件位于 /etc 目录下,其为系统配置sudo用户的一个只读配置文件。在root身份下执行 chmod +w /etc/sudoers命令为该文件添加写权限。

  3.编辑配置文件  

  vi /etc/sudoers

   加入如下配置:用户名  ALL=(ALL)ALL,保存并退出

   4.su切换回普通用户,再次执行sudo命令,已经可以使用

   

    

猜你喜欢

转载自www.cnblogs.com/carryLess/p/9586007.html