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 default permission is 440, therefore, you need to change the permission. After modifying the file, you must change the permission back to the sudoers file. Note the following when changing the permission: Use sudosu-to thoroughly Switch

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:

  1. $ Sudo su-
  2. # Chmod a + w/etc/sudoers
  3. # Vi/etc/sudoers
  4. # 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.

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.