How to use visudo

If you don’t know what it is, you probably shouldn’t be using it. That said, to edit your /etc/sudoers file you need to use

sudo visudo

You have two “modes”
• Command mode – Press ‘ESC’ to access.
• Insert mode – Press ‘I’ to access.
You’re always in one or the other.

• To move the insertion point around, press ‘ESC’ and use the arrow keys.
• Once you’re where you want to be, press ‘I’ and start entering text.
• To delete a character, you need to be in command mode, select the character and press the delete key. (Note: not the Backspace key) You can do this in insert mode, but it does some funky things with the text.
• To save your changes, in command mode, type :w and press enter.
• To quit, in command mode, type :q and press enter.
• To quit without saving any changes, in command mode, type :q! and press enter.

Be careful, if you mess it up, you will no longer be able to sudo. Then you need to sudo to fix it. Bit of a problem there. To fix it, you need to login as root, run visudo, and fix the file.

About these ads
Posted in Linux. 13 Comments »

13 Responses to “How to use visudo”

  1. mihai2k Says:

    Thank you for this post. Helped me a lot with my ubuntu :)

  2. Keith Says:

    I spent an hour trying to figure out the V! editor; thanks so much for the post.

  3. Dan Says:

    Very clear and concise. Helped me. Thanks.

  4. Jared Says:

    This was helpful. Thanks for posting it. For some reason I couldn’t delete text correctly until I realized I had to type ‘d’ and then press the right arrow. Pressing ‘d’ then down would delete a whole line! ‘Vi’va la Emacs!

  5. deb Says:

    This was helpful — Thx

  6. Van Vo Says:

    This is wonderful documents. Good job! Mathew

  7. Muhammed Refaai Says:

    Reblogged this on Muhammed Refaai and commented:
    Interesting tip for adding your account on sudoers.d file! ;)

  8. dtrain Says:

    Thanks for the help, you really saved me some time.
    Reblogged on dtraindesigns

  9. Vincenzo Says:

    Clear and concise explanation, thank you!!!!
    You saved me :)

  10. Rayoomh Says:

    please I have a question but I can’t solve it, can you solve me. I must to do it in LUNIX.

    >>
    >>
    >>
    >>

    - enter the command (visudo) t edit the /etc/sudoers file. what is the command Alias for /usr/bin/updated?

  11. Facebook Ads On Wall Says:

    The most suitable time might well be established through the help of
    a high quality marketing professional. It is the newest way to interact with with customers or visitors and the best aspect is, you have complete approval of your focus on if you are using
    a Facebook or myspace application. I have friends who began with a personal profile for a business.

  12. pokemon adventures manga download Says:

    The good news is that the same can be purchased
    almost from all locations as long as one has access to the internet.
    Within the game, the player should not only collect
    Pokemon, but must also collect badges by earning them.
    Once released, it not only enables you to watch the episode at any time you wish to,
    you can also go on and enjoy it over and over again.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: