Skip to content

Account

List account :

find /home -maxdepth 1 -type d -group users | cut -d '/' -f3

Useradd

How to adding user ?

useradd -s /sbin/nologin -G $GRP
useradd -m -G wheel -s /bin/bash $account

Lock / Unlock

Check password status :

passwd -S $USER

Status list :

  • LK: Password locked
  • NP: No password
  • PS: Password set

Unlock

Use the -u to unlock account:

passwd -u $USER

Lock

Use the -L to lock account:

passwd -L $USER

Time life password

Show the account password information:

chage -l $USER

Set minimum day:

chage -m ${NOMBER OF DAY} ${USER}

Sudoers

Autorisation de l’utilisateur max de supprimer dans le dossier.

max ALL=NOPASSWD:/bin/rm -rf $CHEMIN_de_DOSSIER/*

Autorisation pour l’utilisateur matry_mc_fly de lire les fichiers dans le dossier.

marty_mc_fly ALL=NOPASSWD:/usr/bin/cat /var/log/mariadb/*

Last connection

Check last user connection :

last -15 -aFw

For DEB packages only :

cat /var/log/auth.log