LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   getting error using sudo commends. Explained below (https://www.linuxquestions.org/questions/linux-newbie-8/getting-error-using-sudo-commends-explained-below-4175592296/)

nagrawal 10-26-2016 04:00 PM

getting error using sudo commends. Explained below
 
/etc/sudoers: syntax error near line 31 <<<
sudo: parse error in /etc/sudoers near line 31
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

snowday 10-26-2016 04:04 PM

There is an error in line 31 of your /etc/sudoers file.

If you post it, we can help. Without seeing the file, it is hard to guess what the error might be. :)

sneakyimp 10-26-2016 05:23 PM

And, sadly, when there is an error in the sudoers file, it can be literally impossible to fix unless you can somehow gain full root access to the server.

BW-userx 10-26-2016 08:40 PM

what did you change in sudoers file? whatever it is , it is located near or at line 31 ....

Turbocapitalist 10-27-2016 10:54 PM

Depending on your distro, there will be different ways around that. Most involve booting from the rescue disc or USB-stick that you have handy and fixing sudoers. When editing that file, it is a good idea to use the program "visudo" instead of directly working on it. You can still lock yourself out while using "visudo" but at least it will not be because of a syntax errror as it prevents those.

Habitual 10-28-2016 05:31 AM

Ask the admin of the machine.

ondoho 10-28-2016 12:12 PM

Quote:

Originally Posted by sneakyimp (Post 5623404)
And, sadly, when there is an error in the sudoers file, it can be literally impossible to fix unless you can somehow gain full root access to the server.

who said it was a server?
on a local machine, booting into "recovery mode" should do it.

but i agree, if this is a server, it's ... what was the netspeak abbreviation ... SOL, or contact the admin.

BW-userx 10-28-2016 12:15 PM

boot a different linux, USB one.
mount that drive then go in and edit it in god mode. save, exit, reboot the effected system, in like flint.

linux4evr5581 10-28-2016 12:38 PM

If you had used visudo to edit the /etc/sudoers file it would have prompted you if you made any errors before you could exit out of it. This way is alot more safer cus in case you made a mistake you will know beforehand, and be able fix it before it becomes an issue.

sneakyimp 10-28-2016 04:58 PM

Quote:

Originally Posted by ondoho (Post 5624160)
who said it was a server?

Nobody. But how many times have you ever edited the sudoers file on a workstation or phone? Seemed a reasonable assumption to me. Perhaps it's not.

Habitual 10-28-2016 05:11 PM

possibly able to open terminal and issue:
Code:

su - root
and if successful, then
Code:

visudo
and navigate to line 31 and do have a look at the line and the one(s) above and below, especially if you edited this file and made a mistake.
Lines can be commented if prefaced with a "#"

After editing sudoers using visudo correctly saving the file,
in the terminal, type
Code:

exit
and examine your system looking for the original error.


All times are GMT -5. The time now is 11:51 AM.