adding a user to sudo

Tim Chase blinux.list at thechases.com
Tue Oct 25 23:46:56 UTC 2016


> Using visudo is much safer than echoing data to the sudoers file.

I second Chuck's advice about the safety.  Using visudo also does
sanity-checks and syntax checks to make sure there's nothing
obviously and horribly wrong with your file.  It also locks the
file to prevent concurrent (and possibly conflicting) edits to the
file.

> The visudo command lets you edit that file, and if you don't like
> it's choice of editors, you can easily pick your own favorite, like
> this:
> 
> $ EDITOR=nano visudo

I think it looks for $VISUAL first, so I have to do

  $ VISUAL=nano visudo

to change the editor (it works with non-visual editors too, in case
you prefer ed)

> Imagine what would happen if you used only a single greater-than
> instead of a double greater-than by mistake, when you echo
> something to sudoers.

heh, haven't done this with the sudoers file, but have done it
accidentally on other files.  Thank goodness I set up version-control
beforehand.  Have done similarly with biffing up my if= and of=
parameters to dd.  Whoops. There goes that hard-drive.

-tim






More information about the Blinux-list mailing list