Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
visudo /etc/sudoers

When I run that, I get this:

usage: visudo [-c] [-q] [-s] [-V] [-f sudoers]

The manual doesn't seem to explain this. All the resources I find on google tells me I should just be able to execute this as I am...

Update

Without vim it yields the same results

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

Visudo is used just to edit the /etc/sudoers file directly. So you don't need to call vim when you do so, nor the target file. Simply use visudo, and it will automatically open /etc/sudoers with vim.

If you need to escalate your privileges and edit a file with vim, then you wind up using sudo like you have above: sudo vim filename.txt.


--Christopher Karel

share|improve this answer
8  
Don't do sudo vim /etc/sudoers, though! visudo is great because it validates the sudoers file before changing it, which can save you from locking yourself out. If you do want to override what editor gets used, use the EDITOR environment variable (i.e. EDITOR=vim visudo) –  Evan Broder Jul 8 '10 at 13:37
    
Very valid point. Visudo is definitely the way to go when it comes to editing /etc/sudoers. Otherwise, it's really likely you'll bork your sudoers file, and possibly get locked out of your own box –  Christopher Karel Jul 8 '10 at 13:56
add comment

Do what it's telling you to. visudo -f /etc/sudoers is the direct translation of what you're asking. However, /etc/sudoers is the default file it works on, so just normal visudo (no arguments) would work.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.