Usually in a newly installed CentOS, to use root permissions, you must first switch users to root to execute. Does not have sudo features like Ubuntu. However, the functionality of sudo can be very convenient for our operation.
If implemented? I found some resources on the Internet, about the following steps:
(1) switch to root user first
> Su root
To enter the password, I don't have to hint.
(2) Modify/etc/sudoers Read and Write permissions
typically/etc/sudoers read and write permissions are:
-r--r-----. 1 root root 4023 Dec 22:59/etc/sudoers
so we're going to change it to be writable:
> chmod 0640/etc/sudoers
(3) Modify the contents of/etc/sudoers
find the "root all= (All) all" line and add a line after it:
< account name > all= (All) all
then save the changes.
(4) Modify the properties of the file to-r--r-----
If you do not restore, the modified content will not be effective
> chmod 0440/etc/sudoers
log out of your account and re-login is OK.
Add sudo account to CentOS