[Ubuntu] use sudo to modify / etc / sudoers overturned

 

Roll background: use the command line to create a new user, I must mention here that the rollover blog [1], and of course there is no blame mean, posted just to let latecomers to use the correct command to modify the sudoers file. System: Ubuntu18.04

"The new user to increase sudo privileges" use [1],

sudo chmod u+w /etc/sudoers
sudo vi /etc/sudoers

Add in the sudoers

Username ALL = (ALL: ALL) ALL

Quit vi, then

sudo chmod u-w /etc/sudoers

Well, here, seemingly solved the problem of adding sudo privileges to a new user.

However, when it is desired to use the sudo command being given, the following

~ $ Sudo sudo: >>> / etc / sudoers: syntax error line 21 near <<< 
  sudo: / etc / sudoers in the first 21 have parsing error near line 
  sudo: no valid sudoers resources, quit 
  sudo: unable to initialize policy snap-in

what ~~ !!! After some struggle, access to information, is determined by the modified sudo / etc / sudoers file caused by normal modify the file should use the visudo command.

The method according to [2], and then comment out just in sudoers add content to OK.

 

In this process, also encountered some problems, for Ubuntu18 enter the grub, the number of statements online, appear in the BIOS, press and hold the shift, you can enter the grub, but after invalid attempts, ended up using [3] method and successfully entered the grub boot screen.

That is when the BIOS screen appears, press esc, and then there grub command line, enter normal, and then return, immediately press the esc, you can enter the grub boot screen.

references

[1] https://www.jianshu.com/p/d2a05d0ed1c1

[2] https://blog.csdn.net/sinat_32247833/article/details/84202655

[3] https://blog.csdn.net/geekqian/article/details/82912518

Guess you like

Origin www.cnblogs.com/chen-hw/p/12177849.html