LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-01-2004, 09:42 PM   #1
raid517
Member
 
Registered: Feb 2002
Posts: 393

Rep: Reputation: 30
Crap - I screwed up Sudo. Ouch!!!


Hi - well I guess it looks like I don't know it all after all...

I appear to have a small problem with sudo. Being somewhat inexperienced with it and having never really used it in the past, I opted to edit my sudo file with nano (which is a small pico like text editor). I need to do this as a few of my programs refuse to install in root mode as they say it is unsafe - and they express a preference for sudo. Of course to use sudo I need to include myself on the /etc/sudoers list.

Well anyway this seems to have been a big mistake - as it wasn't until afterwards that I learned that the only permissable way to edit the sudoers file is to run the "visudo" command as root.

The problem now is that whenever I try to run the sudo command I always get an error saying :

Code:
raid517@box1:~$ sudo
>>> sudoers file: syntax error, line 20 <<<
sudo: parse error in /etc/sudoers near line 20
raid517@box1:~$
I have no clue what this is saying - except that maybe it didn't like the text editor I used.

My sodoers file currently looks like this:

Code:
# sudoers file.
# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL

# KNOPPIX WARNING: This allows the unprivileged knoppix user to start commands as root
# KNOPPIX WARNING: This is totally insecure and (almost) makes knoppix a second root account.
# KNOPPIX WARNING: Never allow external access to the #knoppix user!!!
knoppix ALL=NOPASSWD: ALL
mythtv ALL=NOPASSWD:/sbin/halt,/sbin/reboot,/bin/mount,/bin/umount,/usr/bin/mplayer,/usr/local/bin/mythbackup,/usr/local/bin/mythrestore.
The question is, what's going on and how do I fix it? I've tried reading the manual for visudo, but unfortunately it wasn't very helpful. I am still no clearer after reading it how exactly to use it to edit /etc/sudoers - or even specifically what I should write. Currently it doesn't appear to respond to any key presses at all.

As I said, all I want to do is to add myself (raid517) to the sudoers list and allow myself as many privlidges as possible without putting security at risk. Specifically in this regard I would like to give myself authority to mount and unmount files/iso's as a sudoer.

Any input anyone can offer will be very much appreciated.

GJ
 
Old 12-01-2004, 10:57 PM   #2
tmorton
Member
 
Registered: Jan 2003
Location: In front of my computer in Oregon, USA
Distribution: Slackware
Posts: 198

Rep: Reputation: 31
Yeah, it doesn't like you to use nano. You need to use the ViSudo program. I'd suggest trying to open up the file in visudo and just saving it :wq!

If not, try and see if there a /etc/sudoers~ (~ means backup in the UNIX world). If so, replace the new one with the old one.

Good luck...
--
Taj
 
Old 12-01-2004, 11:02 PM   #3
lethargo
LQ Newbie
 
Registered: Aug 2003
Location: St. Paul, Minnesota, US
Distribution: Slackware 10
Posts: 27

Rep: Reputation: 15
Is your sudoers file really only 15 lines long, or did the LinuxQuestions forum cut if off somehow? The "syntax error, line 20" message is really wierd if it's only 15 lines long. I also noticed that the last line (line 15) ends with a period. I don't know if that makes any difference or not, but it looked a little wierd to me.

I think the sudoers manual page describes the actual format of the file (as opposed to the visudo manual page). Granted, the sudoers manual page has too much detail if anything.

I don't know why visudo wouldn't be responding to your key presses.
 
Old 12-01-2004, 11:06 PM   #4
tmorton
Member
 
Registered: Jan 2003
Location: In front of my computer in Oregon, USA
Distribution: Slackware
Posts: 198

Rep: Reputation: 31
Oh, sorry, didn't read that last part. After you run visudo you need to press "i" (w/o quotes) to start typing, and hit Esc to exit insert mode. After you've finished your addition, type :wq.

HTH, Taj
 
Old 12-02-2004, 01:34 AM   #5
raid517
Member
 
Registered: Feb 2002
Posts: 393

Original Poster
Rep: Reputation: 30
Thanks, it just needed a newline at the end.

GJ
 
Old 12-02-2004, 05:21 AM   #6
kees-jan
Member
 
Registered: Sep 2004
Distribution: Debian, Ubuntu, BeatrIX, OpenWRT
Posts: 273

Rep: Reputation: 30
Either way, if you add
Code:
   export EDITOR=/path/to/nano
to your .login or .bashrc or whatever, then visudo should be starting nano for you

Groetjes,

Kees-Jan
 
  


Reply



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
Restricting Editing in Sudo (Advanced Sudo Question) LinuxGeek Linux - Software 4 11-04-2006 03:20 PM
Linspire = Crap, Netzero also = Crap rm6990 General 16 09-20-2004 02:35 AM
Can't get more than 60Hz (ouch!) mcnuttj Linux - Software 2 06-14-2004 11:31 AM
Ouch!!! carrja99 General 1 02-24-2003 06:34 PM
Xfree86 4.2.0 OUCH Lexx Linux - General 7 02-26-2002 11:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:27 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
Open Source Consulting | Domain Registration