Add sudo account to CentOS

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.