from The local systemadministrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3for isn't in thesudoers file. This incident would be reported.
Linux By default does not open sudo permissions for the current user (except root)!
One: Enter the Super User
[email protected] root]$ Su-
Two: Start editing and editing
/etc/sudoersFile
[Email protected] etc]# Ls-al | grep sudo -r--r-----. 1 root root 4002 Mar 2 sudoers #对其进行操作drwxr-x---. 2 root root 4096 sudoers.d-r--r-----. 1 root root 1031 sudo-ldap.conf
(1) Force write (or give permission first, then remove permission)
[Email protected] etc]# vim sudoers
(2) Find root all= (all) All this line, add the Run sudo permission below for the required user
Root all=(All) Alluserld all = (all) all #默认是需要去输入userld用户的密码, when Sudo is executed
Userld all= (All) Nopasswd:all #是不需要去输入密码的
(3) The user group can also be operated, consistent with the above
% User Group all=(All) all #默认是需要去输入userld用户的密码, when Sudo is executed% user Group all = (All) Nopasswd:all # There's no need to enter a password.
Three: Testing
[[email protected] root]$ ls #默认是不允许去操作root目录的, permission not allowed New in/var/spool/mail/root[[email protected] root]$ lsls:cannot Open Directory.: Permission denied[ [email protected] root]$ sudo ls #使用sudo执行, user ordinary user to perform some or all of the administrator commands Anaconda-ks.cfg Documents Install.log.syslog public videosapplication Downloads Music templatesdesktop Install.log Pictures test
Linux under sudo command