- Mastering Linux Security and Hardening
- Donald A. Tevault
- 222字
- 2021-07-02 19:19:25
Hands-on lab for setting account and password expiry data
In this lab, you'll create a couple of new user accounts, set expiration data, and view the results. You can do this lab on either the CentOS or the Ubuntu virtual machine. (The only difference will be with the useradd commands.)
- Create a user account for Samson with the expiration date of June 30, 2023, and view the results.
For CentOS:
sudo useradd -e 2023-06-30 samson
sudo chage -l samson
For Ubuntu:
sudo useradd -m -d /home/samson -s /bin/bash -e 2023-06-30
sudo chage -l samson
- Use usermod to change Samson's account expiration date to July 31, 2023:
sudo usermod -e 2023-07-31
sudo chage -l samson
- Assign a password to Samson's account, then force him to change his password on his first login. Log in as Samson, change his password, then log back out to your own account:
sudo passwd samson
sudo passwd -e samson
sudo chage -l samson
su - samson
exit
- Use chage to set a 5 day waiting period for changing passwords, a password expiration period of 90 days, an inactivity period of 2 days, and a warning period of 5 days:
sudo chage -m 5 -M 90 -I 2 -W 5 samson
sudo chage -l samson
- Keep this account because you'll be using it for the lab in the next section.
推薦閱讀
- Node Security
- INSTANT Netcat Starter
- SASE原理、架構(gòu)與實踐
- CSO進階之路:從安全工程師到首席安全官
- 開發(fā)者的Web安全戒律:真實威脅與防御實踐
- Web安全與攻防入門很輕松(實戰(zhàn)超值版)
- 網(wǎng)絡(luò)安全技術(shù)及應(yīng)用(第3版)
- Python Penetration Testing Cookbook
- 可信計算3.0工程初步(第二版)
- 信息安全案例教程:技術(shù)與應(yīng)用(第2版)
- CTF那些事兒
- 網(wǎng)絡(luò)空間安全:拒絕服務(wù)攻擊檢測與防御
- Hands-On Artificial Intelligence for Cybersecurity
- 動態(tài)賦能網(wǎng)絡(luò)空間防御
- 黑客攻防從入門到精通:實戰(zhàn)篇(第2版)