Passwords
Crear usuario de pruebas con home y shell
sudo useradd -m usuario1 -s /bin/bash
Mostramos el status de la clave con -S
sudo passwd -S usuario1
Como se veria una cuenta bloqueada
usuario1 L 2024-02-19 0 99999 7 -1
usuario1 LK 2024-02-19 0 99999 7 -1 (Password locked.)
Como se veria una cuenta con clave
usuario1 P 2024-02-19 0 99999 7 -1
usuario1 PS 2024-02-19 0 99999 7 -1 (Password set, unknown crypt variant.)
Como se veria una cuenta sin clave!!!
usuario1 NP 2024-02-19 0 99999 7 -1
usuario1 NP 2024-02-19 0 99999 7 -1 (Empty password.)
Lo que dicen los Manuales
DEBIAN
Display account status information. The status information consists of 7 fields. The first field is the user's login name. The second field indicates if the user account has a locked password (L), has no password (NP), or has a usable password (P). The third field gives the date of the last password change. The next four fields are the minimum age, maximum age, warning period, and inactivity period for the password. These ages are expressed in days.
FEDORA
This will output a short information about the status of the password for a given account. The status information consists of 7 fields. The first field is the user’s login name. The second field indicates if the user account has a locked password (LK), has no password (NP), or has a usable password (PS). The third field gives the date of the last password change. The next four fields are the minimum age, maximum age, warning period, and inactivity period for the password. These ages are expressed in days. Notes: The date of the last password change is stored as a number of days since epoch. Depending on the current time zone, the passwd -S username may show the date of the last password change that is different from the real date of the last password change by ±1 day. This option is available to root only.
Esquema ejemplo de fechas
HOY | MES | 2MESES | 3MESES | 4MESES | 5MESES |
18/2 | 18/3 | 18/4 | 18/5 | 18/6 | 18/7 |
CLAVE1 | CLAVE2 | CLAVE3 | CLAVE4 | CLAVE4 | FIN |
SETEO | CADUCA | CADUCA | CADUCA | CADUCA | CADUCA |
INICIAL | CLAVE | CLAVE | CLAVE | CLAVE | CUENTA |
Listamos las el estado de propiedades de la clave
sudo chage -l usuario1
Last password change | feb 18, 2024 |
Password expires | |
Password inactive | never |
Account expires | |
Minimum number of days between password change | 0 |
Maximum number of days between password change | |
Number of days of warning before password expires | 7 |
Ver estadisticas de clave
sudo passwd -S usuario1
sudo chage -l usuario1
sudo grep usuario1 /etc/shadow
Seteamos la clave
sudo passwd usuario1
Bloquear la cuenta
sudo passwd -l usuario1
Desbloqueando la cuenta
sudo passwd -u usuario1
Borrar la clave (OJO!!)
sudo passwd -d usuario1
Seteamos con -E la expiracion de la cuenta y fecha
sudo chage -E 2024-06-30 usuario1
Quitamos que tenga que renovarla con -1
sudo chage -E -1 usuario1
Quitamos que tenga que renovarla con -1
sudo chage -M -1 usuario1
Seteamos con -e la expirada hoy de la clave
sudo passwd -e usuario1
Seteamos renovacion con passwd -x
sudo passwd -x 30 usuario1
Quitamos que tenga que renovarla con -1
sudo passwd -x -1 usuario1