Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

New Ubuntu and Debian Approach

This Rather then editing the /etc/sudoers using visudo, this approach ensures that system upgrades will not overwrite your changes,

From the the sudoers man pages,

Code Block
languagebash
#includedir /etc/sudoers.d
sudo will read each file in /etc/sudoers.d, skipping file names that end in ~ or contain a . character to avoid causing
problems with package manager or editor temporary/backup files.  Files are parsed in sorted lexical order.  That is,
/etc/sudoers.d/01_first will be parsed before /etc/sudoers.d/10_second.  Be aware that because the sorting is lexical, not
numeric, /etc/sudoers.d/1_whoops would be loaded after /etc/sudoers.d/10_second.  Using a consistent number of leading
zeroes in the file names can be used to avoid such problems.
Note that unlike files included via #include, visudo will not edit the files in a #includedir directory unless one of them
contains a syntax error.  It is still possible to run visudo with the -f flag to edit the files directly. 

So rather then editing the /etc/sudoers, we create a file, . Create a file, 01_bonsai_disable_password_auth using the sudoers visudo command to ensure proper permissions and locking,

Code Block
languagebash
# Creates file, locks its and validates for syntax errors.
sudo visudo -f /etc/sudoers.d/01_bonsai_disable_password_auth

... in process of verifying this works ...

Older Standard

Use account names associated with a user. For this example, I will be designating adminstrative users under the staff group. To see the list of groups available to you use the command, cat /etc/group.

Note

These steps are assuming that you are logged in with the initial Ubuntu user which as sudo access. If you are using root instead, then you do not need to prefix any command with sudo.

The staff group by default does not normally have sudo access. To grant sudo access to the staff group,

...

languagebash

...

visudo

...

visudo launches your default editor to a special file. Add the following to the bottom of the file,

Code Block
languagebash
# Members of the staff group may gain root privileges
%staff ALL=(ALL) ALL

Create Catch-All serveradmin user

The purpose of serveradmin is the catch-all place to setup things like scripts. It may also, depending on requirements for your organization be used to manually setup software like application servers.

...