- Mastering Linux Security and Hardening
- Donald A. Tevault
- 244字
- 2021-07-02 19:19:26
Using passwd to lock user accounts
You could also lock Katelyn's account with:
sudo passwd -l katelyn
This does the same job as usermod -L, but in a slightly different manner. For one thing, passwd -l will give you some feedback about what's going on, where usermod -L gives you no feedback at all. On Ubuntu, the feedback looks like this:
donnie@ubuntu-steemnode:~$ sudo passwd -l katelyn
[sudo] password for donnie:
passwd: password expiry information changed.
donnie@ubuntu-steemnode:~$
On CentOS, the feedback looks like this:
[donnie@localhost ~]$ sudo passwd -l katelyn
Locking password for user katelyn.
passwd: Success
[donnie@localhost ~]$
Also, on the CentOS machine, you'll see that passwd -l places two exclamation points in front of the password hash, instead of just one. Either way, the effect is the same.
To unlock Katelyn's account, just do:
sudo passwd -u katelyn
In versions of Red Hat or CentOS prior to version 7, usermod -U would remove only one of the exclamation points that passwd -l places in front of the shadow file password hash, thus leaving the account still locked. No big deal, though, because running usermod -U again would remove the second exclamation point.
In Red Hat or CentOS 7, it has been fixed. The passwd -l command still places two exclamation points in the shadow file, but usermod -U now removes both of them. (That's a shame, really, because it ruined a perfectly good demo that I like to do for my students.)
- Node Security
- 攻守道:企業(yè)數(shù)字業(yè)務(wù)安全風(fēng)險(xiǎn)與防范
- 可信計(jì)算3.0工程初步
- INSTANT Metasploit Starter
- INSTANT Burp Suite Starter
- 計(jì)算機(jī)病毒原理與防范(第2版)
- ARM匯編與逆向工程:藍(lán)狐卷·基礎(chǔ)知識(shí)
- 解密數(shù)據(jù)恢復(fù)
- 數(shù)據(jù)要素安全:新技術(shù)、新安全激活新質(zhì)生產(chǎn)力
- 網(wǎng)絡(luò)安全大數(shù)據(jù)分析與實(shí)戰(zhàn)
- 物聯(lián)網(wǎng)信息安全技術(shù)
- 網(wǎng)絡(luò)攻防實(shí)戰(zhàn)研究:MySQL數(shù)據(jù)庫(kù)安全
- 黑客攻防入門
- 黑客攻防從入門到精通:實(shí)戰(zhàn)篇(第2版)
- 企業(yè)安全建設(shè)入門:基于開源軟件打造企業(yè)網(wǎng)絡(luò)安全