User accounts: Difference between revisions

Jump to navigation Jump to search
→‎Adding sudoers: add few sections
→‎Groups: add other sections
→‎Adding sudoers: add few sections
Line 91: Line 91:
jsmith ALL=(ALL:ALL) ALL
jsmith ALL=(ALL:ALL) ALL
</source>
</source>
== Updating sudoers file safely ==
* ''Last checked on Ubuntu 16.04.01 LTS (xenial)''
The command <code>visudo</code> checks the validity of the sudoers file before making the actual update to the file, and this is the recommended way of editing the file because one can potentially lose sudo privileges unintentionally.
<syntaxhighlight lang="bash">
$ sudo visudo
</syntaxhighlight>
Instead editing <span class="shell">/etc/sudoers</span> file I usually create a file at <span class="shell">/etc/sudoers.d/localusers</span> so I edit that instead.
<syntaxhighlight lang="bash">
$ sudo visudo -f /etc/sudoers.d/localusers
</syntaxhighlight>
=== Changing the default editor used for visudo ===
I'm a VIM user, but many of the distros default to nano for newcomers to Linux systems.  You can use the following command to change the default editor that is loaded for visudo and for many other apps.
<syntaxhighlight lang="bash">
$ sudo update-alternatives --config editor
</syntaxhighlight>

Navigation menu