- Mastering Linux Security and Hardening
- Donald A. Tevault
- 295字
- 2021-07-02 19:19:25
Setting expiry data on a per-account basis, with chage
You would only use chage to modify existing accounts, and you would use it for setting either an account expiration or a password expiration. Here are the relevant option switches:

You can set just one of these data items at a time or you can set them all at once. In fact, to avoid frustrating you with a different demo for each inpidual item, let's set them all at once, except for the -d 0, and then we'll see what we've got:
sudo chage -E 2021-02-28 -I 4 -m 3 -M 90 -W 4 charlie
donnie@ubuntu-steemnode:~$ sudo chage -l charlie
Last password change : Oct 06, 2017
Password expires : Jan 04, 2018
Password inactive : Jan 08, 2018
Account expires : Feb 28, 2021
Minimum number of days between password change : 3
Maximum number of days between password change : 90
Number of days of warning before password expires : 4
donnie@ubuntu-steemnode:~$
All expiration data have now been set.
For our final example, let's say that you've just created a new account for Samson, and you want to force him to change his password the first time he logs in. There are two ways to do that. Either way, you would do it after you've set his password initially. We have the following code:
sudo chage -d 0 samson
or
sudo passwd -e samson
donnie@ubuntu-steemnode:~$ sudo chage -l samson
Last password change : password must be changed
Password expires : password must be changed
Password inactive : password must be changed
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
donnie@ubuntu-steemnode:~$
- Android應(yīng)用安全實戰(zhàn):Frida協(xié)議分析
- SASE原理、架構(gòu)與實踐
- 黑客攻防與無線安全從新手到高手(超值版)
- 數(shù)字化轉(zhuǎn)型浪潮下的數(shù)據(jù)安全最佳實踐指南
- Kali Linux Wireless Penetration Testing Cookbook
- 網(wǎng)絡(luò)安全三十六計:人人該懂的防黑客技巧
- CTF競賽權(quán)威指南(Pwn篇)
- 計算機網(wǎng)絡(luò)安全技術(shù)研究
- 從0到1:CTFer成長之路
- 信息安全案例教程:技術(shù)與應(yīng)用(第2版)
- 信息安全等級保護測評與整改指導(dǎo)手冊
- 華為Anti-DDoS技術(shù)漫談
- Android Application Security Essentials
- Developing Applications with Salesforce Chatter
- 反黑風暴:黑客社會工程學攻防演練