LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-26-2016, 05:00 PM   #1
nagrawal
LQ Newbie
 
Registered: Oct 2016
Posts: 1

Rep: Reputation: Disabled
Post 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
 
Old 10-26-2016, 05:04 PM   #2
snowpine
Senior Member
 
Registered: Feb 2009
Posts: 4,148

Rep: Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159
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.
 
Old 10-26-2016, 06:23 PM   #3
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,003

Rep: Reputation: 67
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.
 
Old 10-26-2016, 09:40 PM   #4
BW-userx
Senior Member
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Void Linux / Slackware 14.2
Posts: 3,110

Rep: Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543
what did you change in sudoers file? whatever it is , it is located near or at line 31 ....
 
Old 10-27-2016, 11:54 PM   #5
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Ubuntu, Devuan, OpenBSD
Posts: 1,393
Blog Entries: 3

Rep: Reputation: 569Reputation: 569Reputation: 569Reputation: 569Reputation: 569Reputation: 569
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.
 
1 members found this post helpful.
Old 10-28-2016, 06:31 AM   #6
Habitual
LQ Addict
 
Registered: Jan 2011
Posts: 7,680
Blog Entries: 10

Rep: Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080
Ask the admin of the machine.
 
1 members found this post helpful.
Old 10-28-2016, 01:12 PM   #7
ondoho
Senior Member
 
Registered: Dec 2013
Posts: 4,658

Rep: Reputation: 986Reputation: 986Reputation: 986Reputation: 986Reputation: 986Reputation: 986Reputation: 986Reputation: 986
Quote:
Originally Posted by sneakyimp View Post
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.
 
Old 10-28-2016, 01:15 PM   #8
BW-userx
Senior Member
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Void Linux / Slackware 14.2
Posts: 3,110

Rep: Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543
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.
 
Old 10-28-2016, 01:38 PM   #9
linux4evr5581
Member
 
Registered: Sep 2016
Posts: 207

Rep: Reputation: Disabled
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.

Last edited by linux4evr5581; 10-28-2016 at 01:41 PM.
 
1 members found this post helpful.
Old 10-28-2016, 05:58 PM   #10
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,003

Rep: Reputation: 67
Quote:
Originally Posted by ondoho View Post
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.
 
Old 10-28-2016, 06:11 PM   #11
Habitual
LQ Addict
 
Registered: Jan 2011
Posts: 7,680
Blog Entries: 10

Rep: Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080
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.

Last edited by Habitual; 10-28-2016 at 06:15 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why i am getting this error when trying to do su sudo prathamesh7478 Linux - Newbie 4 10-02-2013 02:53 AM
sudo error f4drvr Linux - Server 4 09-18-2013 02:41 PM
LXer: The Ultimate Sudo FAQ To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 02:36 AM
[SOLVED] error of sudo sandyrouge Linux - Newbie 4 03-08-2011 12:33 AM
sudo error mouse46 Ubuntu 7 03-07-2009 07:20 AM


All times are GMT -5. The time now is 01:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration