Linux User Management

Create a User

Use useradd to create a user.

Example:

useradd ctesdahl

Optionally, you can specify the shell used for that user upon creation:

useradd --shell=/usr/bin/zsh ctesdahl

You can also specify which groups the user will be a part of:

useradd --groups=docker ctesdahl

Change or Set User Password

From root account, you can set another user’s password:

passwd ctesdahl

If you’re just wanting to change the password on the current account:

passwd

Add User to Sudoers

Edit the /etc/sudoers file:

visudo

You should see existing sudoers, including root:

##
## User privilege specification
##
root ALL=(ALL) ALL
tmorneau ALL=(ALL) ALL
dmatthews ALL=(ALL) ALL
mattheda ALL=(ALL) ALL
ccarlson ALL=(ALL) ALL

Add an entry for the new user:

ctesdahl ALL=(ALL) ALL