Situatie
Ca best practice este necesar ca unii useri sa aiba “expire password” ca politica. By default Ubuntu 22.04 LTS vine cu perioada 99999 adica practic unlimited. In continuare vom crea un user nou si ii vom seta expire password la 30 zile.
Solutie
Pasi de urmat
“CTRL+ALT+T” pentru a deschide un terminal nou si cream user-ul test:
sudo adduser test
Urmam ghidul si setam parola.
Dupa ce am creat user-ul putem vizualiza detalii despre el cu:
sudo chage -l test
Exemplu output:
Last password change : feb 08, 2023
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
Setam expire policy la 30 zile pentru user:
sudo chage -I -1 -m 0 -M 30 -E -1 test
Pentru a vedea modificarile putem repeta comanda sudo chage -l test
Exemplu output:
Last password change : feb 08, 2023
Password expires : mar 10, 2023
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 30
Number of days of warning before password expires : 7
Tip solutie
PermanentPlan de restaurare in caz de nefunctionare
Pentru a schimba la 99999 zile putem folosi comanda:
sudo chage -I -1 -m 0 -M 99999 -E -1 username
Leave A Comment?