Modifying user settings isn’t something I do everyday but it is necessary occasionally

You can add a user with the ==useradd== command

sudo useradd -m -s /bin/bash Ted

The command adove does several things. It adds a user named Ted. additionally the -m option automatically creates the users home directory structure and the -s option sets the shell to be used. In this case to bash.

==usermod== is useful for working on a current users priveleges.

The most common use I have for it is adding my user to a group for additional priveleges
make sure to use the -a or you will remove them from other groups

usermod -a -G groupname username

For example we want to add Ted to the foo group

usermod -a -G foo Ted\

You can see all the available usergroups in your /etc/group fiile

Other usermod functions:

1 Change a users primary group

usermod -g groupname username
  1. Set an expiration date for a user account
usermod -e YYYY-MM-DD username

this is useful if you want a friend to have temporary access to your machine

  1. Change users home directory
usermod -d filepath username
  1. change users login name
usermod -l newusername currentusername
  1. Lock a user account to prevent them from logging in
usermod -L username

To unlock them

usermod -U username
  1. change user shell
usermod -s shell path username

for example

usermod -s /bin/bash Ted

will set teds shell to bash

Associated command to usermod


==id username==

will give you info on the user such as uuid groups etc.

list all users on the system

cut -d: -f1 /etc/passwd


View recent login history for a user

last username ```