LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sudo file (https://www.linuxquestions.org/questions/linux-newbie-8/sudo-file-4175431473/)

siickboii 10-10-2012 06:50 AM

sudo file
 
I was exploring the sudo file (fedora16) in visudo and accidently deleted a couple of lines. Now I get this when I open visudo;
E325: ATTENTION
Found a swap file by the name "/etc/.sudoers.tmp.swp"
owned by: root dated: Tue Oct 9 20:49:35 2012
file name: /etc/sudoers.tmp
modified: YES
user name: root host name: laptopredhat
process ID: 11679
While opening file "/etc/sudoers.tmp"
dated: Tue Nov 30 06:13:58 2010

(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" 97L, 3338C
Press ENTER or type command to continue...

Any ideas how i reslove this?

segmentation_fault 10-10-2012 07:08 AM

Well, the error is quite explaining the situation. Either you are editing the sudoers file with two editors, or a visudo session didn't complete sucessfully. If you are absolutely confident that your sudoers file is ok, you could delete the .tmp.swp file. If you think you should recover, do as suggested.

Snark1994 10-10-2012 07:18 AM

It sounds like visudo crashed. I believe that /etc/sudoers.tmp is a lockfile that is also used as a temporary file to ensure the contents you enter are valid (before copying them to /etc/sudoers). I think it is safe to delete. I would first make a backup of both /etc/sudoers and /etc/sudoers.tmp (just in case), then delete /etc/sudoers.tmp and /etc/.sudoers.tmp.swp and then try running visudo again.

Hope this helps,

siickboii 10-10-2012 12:32 PM

what are the commands to delete the swap file?

segmentation_fault 10-10-2012 03:02 PM

Code:

$ man rm

siickboii 10-10-2012 04:00 PM

man rm /ect/.sudoers.tmp.swp
Is that correct?

segmentation_fault 10-10-2012 04:11 PM

Code:

man rm
will give you info about rm command. In your case it would be
Code:

$ rm /ect/.sudoers.tmp.swp
but also take a look at the man page.

siickboii 10-10-2012 04:37 PM

[timmytim@laptopredhat ~]$ rm /ect/.sudoers.tmp.swp
rm: cannot remove `/ect/.sudoers.tmp.swp': No such file or directory

segmentation_fault 10-10-2012 04:42 PM

How about /etc/sudoers.tmp ?

siickboii 10-10-2012 05:25 PM

rm -f /etc/.sudoers.tmp.swp was the ticket all is well now


All times are GMT -5. The time now is 05:29 AM.