How to add sudo account in CentOS system

  
                  

Usually you must use root privileges in the newly installed CentOS before you can switch to the root to execute. Not like ubuntu comes with sudo function. But sudo this function can bring great convenience to our operation.

If implemented? I found some resources on the Internet, probably the following steps: (1) first switch to the root user > su root

(2) modify the read and write permissions of /etc/sudoers Usually /etc/sudoers read and write Permissions are: -r--r-----. 1 root root 4023 Dec 28 22:59 /etc/sudoers So we have to change it to writable: > chmod 0640 /etc/sudoers

(3) Modify the contents of /etc/sudoers Find the line "<;root ALL=(ALL) ALL”, add a line after it: <account name> ALL=(ALL) ALL Then save the changes.

(4) Modify the file's properties to -r--r----- If you do not restore, the modified memory will not take effect. > chmod 0440 /etc/sudoers

Sell account, re-login is OK.

Copyright © Windows knowledge All Rights Reserved