LinuxQuestions.org
Review your favorite Linux distribution.
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 03-15-2008, 08:09 PM   #1
CrinkElite
Member
 
Registered: Nov 2007
Posts: 35

Rep: Reputation: 16
sudoers config file crashed while editing and can no longer be written to


Hi folks. I'm having a little trouble configuring the sudo command.
I'm running pendrive linux 2008. I installed it to a 1G usb from windows
here's the exact version
http://www.pendrivelinux.com/2008/02...dows/#more-342

I'm relatively new to linux.
the os does not come with sudo installed so i used the gui to locate and install the package. everything was going fine until i attempted to edit the file which controls the sudoers password settings and permissions using the CLI command

su --login -c 'visudo'

this loads a terminal edit session which contains a list of the sudo settings which can be edited and presumably saved.

while in this editing the page the edit session crashed so i loaded another terminal and re-entered the "su --login -c 'visudo'" command but instead of going straight to the settings file it gives this message




E325: ATTENTION
Found a swap file by the name "/etc/.sudoers.tmp.swp"
owned by: ******** dated: Sat Mar 15 08:32:34 2008
file name: /union/etc/sudoers.tmp
modified: YES
user name: ******** host name: 192.168.1.1
process ID: 9803
While opening file "/etc/sudoers.tmp"
dated: Tue Feb 27 14:41:40 2007

(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.

(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r /etc/sudoers.tmp"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/etc/.sudoers.tmp.swp"
to avoid this message.
"/etc/sudoers.tmp" 30L, 631C
Press ENTER or type command to continue


(for this post I've edited out the root login with *'s )


Then it displays the settings file but it will not save on exit.
it just reports that the sudoers file is unchanged.

When I try the :recover command I am presented with this



Swap files found:
Using specified name:
1. .sudoers.tmp.swn
owned by: ***** dated: Sat Mar 15 09:20:11 2008
file name: /union/etc/sudoers.tmp
modified: YES
user name: ****** host name: 192.168.1.1
process ID: 6656
2. .sudoers.tmp.swo
owned by: ****** dated: Sat Mar 15 08:57:16 2008
file name: /union/etc/sudoers.tmp
modified: YES
user name: ****** host name: 192.168.1.1
process ID: 6078
3. .sudoers.tmp.swp
owned by: ***** dated: Sat Mar 15 08:32:34 2008
file name: /union/etc/sudoers.tmp
modified: YES
user name: ****** host name: 192.168.1.1
process ID: 9803
In directory ~/tmp:
-- none --
In directory /var/tmp:
-- none --
In directory /tmp:
-- none --

Enter number of swap file to use (0 to quit):

#So I selected the oldest file -number 3


Enter number of swap file to use (0 to quit): 3
Using swap file "/union/etc/.sudoers.tmp.swp"
Original file "/union/etc/sudoers.tmp"
Recovery completed. You should check if everything is OK.
(You might want to write out this file under another name
and run diff with the original file to check for changes)
Delete the .swp file afterwards.


Press ENTER or type command to continue





using the teminal i have located these two files in the /union/etc/

sudoers
sudoers.tmp
suspend.conf

I'm not sure what the last part of the :recover output means by writing out the file under another name and running diff (sounds complicated)
my microsoft experiences tells me i should just rm all these sudoer files
and uninstall/reinstall the sudo package, however i dare not do this without a second opinion.

the other thing is that this distro is designed to be installed to a usb without the need to create a second partition for saving the changes in persistence mode. I *think* it saves changes to a special file located on the os partition. there is no active forum for this distro so I'm finding it hard to figure it out. I know that the swap file is located in system memory when the OS is running but i believe it must be saved to disk at shutdown because the shutdown funtions more like suspend ie. All programs that were open at the time of shutdown are restored faithfully on reboot . I don't know if that stuff is important or not but i said I'de better stick it in there just in case.

thanks a million for reading and sorry about the length, any info would be appreciated.
 
Old 03-15-2008, 11:23 PM   #2
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
Quote:
Recovery completed. You should check if everything is OK.
(You might want to write out this file under another name
and run diff with the original file to check for changes)
Delete the .swp file afterwards.
these just means that you save the session to another file instead of the file you're trying to edit (original) then compare the original with the saved file.. just in case nothing's wrong with their difference, save the file to the original name.. for example if you saved it to a ifferent filename, like /union/etc/sudoers.tmp.new, do

Code:
diff -u /union/etc/sudoers.tmp{,.new}
then if there's not much difference,
do
Code:
mv /union/etc/sudoers.tmp{.new,}
which will replace the original

edit:
it's not really the new saved file that matters.. you should compare the swap file with the original instead:
Code:
diff -u /union/etc/sudoers.tmp{,.swp}

Last edited by konsolebox; 03-15-2008 at 11:28 PM.
 
Old 03-16-2008, 01:02 AM   #3
CrinkElite
Member
 
Registered: Nov 2007
Posts: 35

Original Poster
Rep: Reputation: 16
thanks for the info konsolebox. It turns out that i wasn't using the right commands for the visudo editor and then I was getting the syntax wrong but thankfully i got it sorted, thanks for explaining the diff command, i didn't need it though I found a sample sudoers file
I was able to confirm that there are no errors in it
here's the sample

http://www.sudo.ws/sudo/sample.sudoers

thanks again
 
  


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
Editing Sudoers File... aapanju Linux - Newbie 7 03-06-2008 10:10 PM
Editing sudoers (shows as new file in nano) rushinblue Linux - Newbie 2 11-06-2007 02:17 PM
BASH - determine when file is no longer written to marwal Programming 10 03-27-2007 07:51 PM
redhat8, changed hostname by editing config file, X no longer recognizes it infamous41md Linux - Newbie 2 03-31-2004 01:20 AM
Help Editing Sudoers File Rubicone Linux - Newbie 2 05-03-2002 02:50 AM

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

All times are GMT -5. The time now is 01:58 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