Edit sudoers with visudo and nano

Matt • July 20, 2011

linux

Editing sudoers file allows you to manage which users can use the sudo command. You should never modify this file by hand, and syntax errors will make it so you can't use sudo and possibly not be able to edit the file again. To modify it you should use the command visudo. This opens the sudoers file in vi so you can edit it.

I was attempting to edit mine with vi and for some reason it wasn't working properly. I can get around in vi decently. I'm no expert at it, but I am able to edit files and save them. This time, I couldn't get it to change the way I wanted to. Instead of fighting with it, I just decided to use nano and get it done quickly. I only wanted to change one line anyway. To use nano with visudo, simple run it this way:

sudo EDITOR=nano visudo