Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix /etc/sudoers: syntax error near line number

I am new to Ubuntu. And as while editing anything in visual studio code, I had to enter password. so for that I tried to change in sudoers file but after that I am unable to find what happened and also getting error like below.

I used the command to change i

sudo nano -w /etc/sudoers

after which i pressed ctrl+x

/etc/sudoers: syntax error near line 26 <<<
sudo: parse error in /etc/sudoers near line 26
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

Thank you.

like image 855
Dcoder14 Avatar asked Oct 15 '22 10:10

Dcoder14


2 Answers

Edit:

On your terminal type:

pkexec nano /etc/sudoers

It will open the file and you can edit now. To save and exit the file, just press:

Ctrl+X

And it will ask you if you wanna save the file. So type: Y and Enter. Done!!!

like image 135
Scott Avatar answered Oct 21 '22 04:10

Scott


we have to write -
pkexec visudo
And it will open the file and one need to change as previous if any made.
Then type Ctrl+X which will ask to save the file. So type: Y and Enter
like image 40
Dcoder14 Avatar answered Oct 21 '22 05:10

Dcoder14