LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 03-01-2009, 08:36 AM   #1
PClOStinspace
Member
 
Registered: Jun 2008
Location: Bracknell, UK
Distribution: Ubuntu 13.10 Saucy
Posts: 152

Rep: Reputation: 19
Bad line in etc/sudoers


HELP ME!!

I have screwed my system up again!! I was trying to get mountpy to run w/o requiring a password every time. I followed the advice the app gave me and added

"gregg ALL = NOPASSWD: /usr/bin/mountpy, usr/bin/umountpy"

to the end of my etc/sudoers then every time I try to sudo anything I get a failure telling me that there is a error in line 36 of etc/sudoers.

How do I restore etc/sudoers without root acess?? I am running Kubuntu feisty if that makes any difference to anything.

Thanks.
 
Old 03-01-2009, 08:50 AM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Boot the live CD

Mount the root partition

Edit the file
 
Old 03-01-2009, 08:51 AM   #3
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Guessing that line 36 says this:
Quote:
"gregg ALL = NOPASSWD: /usr/bin/mountpy, usr/bin/umountpy"
... take a look at the second path on that line... shouldn't there be a / at the start?
 
Old 03-01-2009, 09:18 AM   #4
PClOStinspace
Member
 
Registered: Jun 2008
Location: Bracknell, UK
Distribution: Ubuntu 13.10 Saucy
Posts: 152

Original Poster
Rep: Reputation: 19
Thanks

Thanks all.

I'll try editing from a live cd and report back, before I do though, it shouldn't matter if the live cd is a different distro should it??
 
Old 03-01-2009, 09:22 AM   #5
PClOStinspace
Member
 
Registered: Jun 2008
Location: Bracknell, UK
Distribution: Ubuntu 13.10 Saucy
Posts: 152

Original Poster
Rep: Reputation: 19
Also, should the line I added be in a specific place in the file? I just added it at the end.
 
Old 03-01-2009, 09:45 AM   #6
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Hi PCIO
Quote:
it shouldn't matter if the live cd is a different distro should it??
Nope, all you're doing is editing a text file.
Quote:
Also, should the line I added be in a specific place in the file? I just added it at the end.
That should be fine.
Just out of curiosity, is all this necessary because you don't get a root account with Ubuntu? Is it true that if you want a root account you have to go through a song and dance to set one up?
I can't believe that. It must be an urban myth.
cheers,
jdk
 
Old 03-01-2009, 09:55 AM   #7
dkaplowitz
Member
 
Registered: Oct 2002
Location: Havertown PA
Distribution: Ubuntu/RHEL/Fedora
Posts: 253

Rep: Reputation: 31
Quote:
Originally Posted by jdkaye View Post
Is it true that if you want a root account you have to go through a song and dance to set one up?
I can't believe that. It must be an urban myth.
A song and dance like changing the password for root to something other than the default value? How dare they make us do so much work to have a root account!
 
Old 03-01-2009, 10:10 AM   #8
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Quote:
Originally Posted by dkaplowitz View Post
A song and dance like changing the password for root to something other than the default value? How dare they make us do so much work to have a root account!
Apparently too much work for the OP.
jdk
 
Old 03-01-2009, 10:48 AM   #9
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
While there is a reason the root account is inaccessable by default, if users will insist on having passwordless sudo ...

Still, passwordless sudo is still more secure than passwordless root... just.
 
Old 03-01-2009, 11:14 AM   #10
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Quote:
Originally Posted by Simon Bridge View Post
While there is a reason the root account is inaccessable by default, if users will insist on having passwordless sudo ...

Still, passwordless sudo is still more secure than passwordless root... just.
I'm having trouble following this logic. Are you saying that if users will insist on having sudo with no password (not even their own?!?!?!) then they will insist on having a root account with no password. I can't imagine anyone wanting either one. Are you claiming that systems with a root account such as Debian are inherently less secure than those that don't provide one by default? As I see it, not having a root account gives you the opportunity to paint yourself into a box, which is what happened to the OP. I he had had a root account the solution to his problem would have been trivial. That's all I was saying.
cheers,
jdk
 
Old 03-01-2009, 12:10 PM   #11
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
Originally Posted by jdkaye View Post
I'm having trouble following this logic. Are you saying that if users will insist on having sudo with no password (not even their own?!?!?!)
As is the case with OP - OK, for one command (that we know about.)
Quote:
then they will insist on having a root account with no password.
Nope
Quote:
I can't imagine anyone wanting either one.
many users do - we see it less these days but it happens.
Quote:
Are you claiming that systems with a root account such as Debian are inherently less secure than those that don't provide one by default?
.

https://help.ubuntu.com/community/RootSudo

Having a root account should be more secure - and, used properly, it usually is...

Quote:
As I see it, not having a root account gives you the opportunity to paint yourself into a box, which is what happened to the OP.
Yes, that's right - and the same logic is why people leave a spare house-key under the mat (or in a fake rock in the garden.)
Quote:
I he had had a root account the solution to his problem would have been trivial. That's all I was saying.
cheers,
jdk
Of course - he could have just accepted that a password is needed for admin tasks. That would have made the problem less than trivial.

FWIW - you are right - more than one access is easier when things go wrong. When you lose your keys or lock yourself out of the house.

Don't get me wrong: this was not a criticism of your post.
 
Old 03-01-2009, 01:38 PM   #12
PClOStinspace
Member
 
Registered: Jun 2008
Location: Bracknell, UK
Distribution: Ubuntu 13.10 Saucy
Posts: 152

Original Poster
Rep: Reputation: 19
Sorry for causing an argument guys!

I am not great with the whole linux thing yet, I moved over from windows a while back and don't read too much!!

Any way, I'm now logged into my live system (Xubuntu) and am having another fairly basic problem. I can't figure out how to mount my drive(s). I would usually see them as unmounted in the left hand pane of Dolphin, click, enter root password (which I do have!) and presto.

In my Xubuntu live system, I do not have a nice easy gui option (that I know of) so its into terminal. How do I locate the drive to mount? Like I said, it's a basic problem, but I spend as little time with cli as possible as I don't know my way around!!

Thanks again.

OK Sussed it, I opened the partition editor and all my drives popped open in seperate Thunar windows.

Trying a reboot into Kubuntu next. Hopefully I'll be back to give the all clear shortly.

Thanks again though, us muppets need a little steering occasionally:-)

Last edited by PClOStinspace; 03-01-2009 at 02:07 PM.
 
Old 03-01-2009, 05:37 PM   #13
PClOStinspace
Member
 
Registered: Jun 2008
Location: Bracknell, UK
Distribution: Ubuntu 13.10 Saucy
Posts: 152

Original Poster
Rep: Reputation: 19
Done

I'm back to square one again. I had to go back into the live cd again and remove the whole line as it still caused an issue even with the amended syntax.

The whole reason for doing this is I have a couple of drives that I want to mount automatically at startup. I have tried editing fstab before to achieve this to no avail.

I'll keep on plodding and look for another solution.
 
Old 03-01-2009, 09:14 PM   #14
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Quote:
Originally Posted by PClOStinspace View Post
I'm back to square one again. I had to go back into the live cd again and remove the whole line as it still caused an issue even with the amended syntax.
I'm running Kubuntu. The sudoers file has several examples. If you look at those and then look at the entry that you created it should be evident how your entry does not conform to the syntax.

Quote:
Originally Posted by PClOStinspace View Post
The whole reason for doing this is I have a couple of drives that I want to mount automatically at startup. I have tried editing fstab before to achieve this to no avail.
Nevertheless the better approach is to create entries in the /etc/fstab file to automatically mount disk partitions at boot time.

Quote:
Originally Posted by PClOStinspace View Post
I'll keep on plodding and look for another solution.
What are the device mappings to the disk partitions that are not working? (/dev/sda1, /dev/hdc4, ???)

The basic syntax of /etc/fstab entries are as follows:

<device> <mnt-point> <file-type> <mount-params> <frequency> <fsck>

An example entry is as follows:

/dev/sda3 /mnt/sda3 auto auto,defaults 0 0

Last edited by stress_junkie; 03-01-2009 at 09:21 PM.
 
Old 03-01-2009, 09:19 PM   #15
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Quote:
Originally Posted by Simon Bridge View Post
While there is a reason the root account is inaccessable by default, if users will insist on having passwordless sudo ...

Still, passwordless sudo is still more secure than passwordless root... just.
If the command is one such as ejecting the cdrom drive, I don't think there is much of a problem. Using polkit might be better for this because you can indicate that it is a local user.

---

The OP should have used the "visudo" program to edit the sudoers file. That adds error detection and gives you the option to fix the problem or abort the edit.

---
If the partitions are on external drives, use the "noauto" option in /etc/fstab. Also use UUID=<the_uuid_number> instead of the device name. If you own the filesystem and also use the "users" option, you can mount the partition as a normal user. You don't need to use sudo at all. You could even put the mount command in your .bash_login (or .profile) file so they mount when you login. ( note: maybe add some logic to test for the device before trying ).
The mount command is one of the few that are legitimately suid root.

Last edited by jschiwal; 03-01-2009 at 09:28 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
parse error in /etc/sudoers near line -1 RAFAL Linux - Newbie 2 11-10-2008 11:56 AM
Line 7 in /etc/fstab is bad!!! Please Help da_xlnc Linux - General 9 07-20-2006 07:03 AM
Line 7 in fstab bad.... cooljed Linux - General 1 01-11-2006 07:42 AM
I deleted /etc/sudoers and creates a new file call sudoers but now it doesnt for visu abefroman Linux - Software 1 11-10-2005 06:03 PM
Bad line in fstab dubya Fedora 2 06-19-2005 03:49 PM


All times are GMT -5. The time now is 03:47 AM.

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