So... I accidentally opened up visudo by typing
vi visudo
and at the same time I also prefer nano so I just naturally pressed ctrl+x to exit, then didn't realize right away that I was in vi (yes i'm slow haha) and kept trying :P... anyway, I finally realized and haven't used vi in a while so I thought that :x would exit without saving, but I guess thats not the case and now when I try开发者_Python百科 to visudo I get
-bash: /usr/sbin/visudo: cannot execute binary file
Any idea what I can do to fix this? The actual /etc/sudoers file is fine, i can open it and it looks normal, dont see anything wrong with it. So I guess its just the visudo file. Can I replace it or something?
Oh, and using Ubuntu 8.04 (Hardy)
visudo
just a binary file with no built-in configurations, so you can safely replace it. Is included in the sudo
package, which you can reinstall by typing:
sudo apt-get install --reinstall sudo
And if you're inclined to learn how to use the editor you stumbled onto, try typing
vimtutor
If all you care to know is how to exit vi / vim without breaking anything, the way to do is to type :q!
You can launch visudo simply by typing visudo
. If you type vi visudo
, then you are trying to edit visudo with vi, which I hope is not what you are intending to do. Visudo is meant for editing certain configuration files in a safe manner. If you edit the files with an ordinary editor, you might might make mistakes and screw up the settings in an unrecoverable state. Use visudo to edit files like sudoers.
精彩评论