Digital Marketing

Lock (Disable) User Account on Linux

Passwd command can be used to lock or disable a user account.


To lock:
# passwd openvpn –l
Above command changes the shadow file and adds “!” in front of the user password

To unlock
# passwd openvpn -u
You can also enable account by removing manually the “!” character from the user’s password line in /etc/shadow.
bit@goyun.info:~$ sudo passwd openvpn -l
passwd: password expiry information changed.
bit@goyun.info:~$ sudo grep openvpn /etc/shadow
openvpn:!$6$PotCU3QmMD7JsvbS$cAM5Ti0pcPxgFXw87hwCGJqUWXPhN10eD8SMrRXMu/kUKJAh5sgHcTgSPAGUjeGd1HgmwRB4xDekGASyOBpVj0:18681:0:99999:7:::
nm-openvpn:*:18530:0:99999:7:::
openvpn_as:!:18673:0:99999:7:::
bit@goyun.info:~$ sudo passwd openvpn -u
passwd: password expiry information changed.
bitcoin@goyun.info:~$ sudo grep openvpn /etc/shadow
openvpn:$6$PotCU3QmMD7JsvbS$cAM5Ti0pcPxgFXw87hwCGJqUWXPhN10eD8SMrRXMu/kUKJAh5sgHcTgSPAGUjeGd1HgmwRB4xDekGASyOBpVj0:18681:0:99999:7:::
nm-openvpn:*:18530:0:99999:7:::
openvpn_as:!:18673:0:99999:7:::
bit@goyun.info:~$ 


Comments

Popular posts from this blog

Fixed WSL sshd: no hostkeys available -- exiting

PowerMTA pmta command

How to fix: mv: failed to preserve ownership