Machetes

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

HOYMES2MESES3MESES4MESES5MESES
18/218/318/418/518/618/7
CLAVE1CLAVE2CLAVE3CLAVE4CLAVE4FIN
SETEOCADUCACADUCACADUCACADUCACADUCA
INICIALCLAVECLAVECLAVECLAVECUENTA

Listamos las el estado de propiedades de la clave

sudo chage -l usuario1
Last password change feb 18, 2024
Password expiresnever/mar 19, 2024
Password inactivenever
Account expiresnever/jul 18, 2024
Minimum number of days between password change0
Maximum number of days between password change99999/30
Number of days of warning before password expires7

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

Scroll al inicio