Sudo cannot be solved when new users are added to Ubuntu: modify sudoers

Source: Internet
Author: User
The newly added hadoop user in Ubuntu cannot execute commands through sudo. the prompt is hadoopisnotinthesudoersfile... to solve this problem, you only need to switch to another user who can execute sudo and modify the/etc/sudoers file. however, be careful when modifying this file ,...

 

The newly added hadoop user in Ubuntu cannot execute the command through sudo. the prompt is:

 

Hadoop is not in the sudoers file...

 

 

To solve this problem, you only need to switch to another user who can execute sudo and modify the/etc/sudoers file. however, be careful when modifying this file. the default permission is 440, so we need to change the permission. after modifying the file, we can change the permission back.

 

Note the following when downgrading sudoers files:

 

Use sudo su-to completely switch to the root, otherwise it will not work

 

Run the following command:

 

$ Sudo su-

# Chmod a + w/etc/sudoers

# Vi/etc/sudoers

# Chmod a-w/etc/sudoers

$ Sudo su-

# Chmod a + w/etc/sudoers

# Vi/etc/sudoers

# Chmod a-w/etc/sudoers

After vi/etc/sudoers, add:

 

Hadoop ALL (ALL) ALL

 

Save and exit. hadoop is the user name that needs to grant sudo execution permission.

 

Another method to modify the sudoers file is available in many places on the Internet:

 

Restart Ubuntu, press Esc or Shift to enter the grub boot menu, select recovery mode, and select root to log on. then, you can modify the sudoers file permissions.

 

If sudo cannot be used by all users on the system, this method would have to be used.

Author bhq2010

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.