Basic Linux User Administration
Since this can be a challenge to remember in a pinch, I decided I'd post these basic linux user administration commands. Please keep in mind that these commands/options are not the same across all distros so your milage may vary.
Lock an Account:
passwd -l {username}
Unlock an Account:
passwd -u {username}
Display Account Status:
passwd -S {username}
Note: Status is indicated by P, L, NP which is usable password, no password and locked account respectively.
Example script(s):
passwd -S -a | grep " L " | cut -d " " -f1 passwd -S -a | awk '/L/{print $1}'
Add User to Secondary Group:
RHEL/DEB: usermod -a -G {group} {username} SLES: usermod -A {group} {username}
Expire Password:
passwd -e {username} chage -d 0 {username} passwd -f {username}
0 Comments