Centos系统默认是没有开启sudo命令,如下提示:

[user@localhost ~]$ sudo ls /root

[sudo] password for user: 

user is not in the sudoers file.  This incident will be reported.

#

#需要编辑/etc/sudoers后添加,可以两种方式!

[root@localhost ~]# visudo

添加如下:

user    ALL=(ALL)    ALL

用户     

%sa    ALL=(ALL)    ALL

组