linux系统用户锁定与解锁教程

2020-04-01由程序员日记发表于系统教程 浏览31次

1、使用passwd命令锁定与解锁账号 [[email protected] ~]# passwd -l testuser --- -l 锁定 Locking password for user testuser. passwd: Success [[email protected] ~]# passwd -S testuser --- 查看状态 testuser LK 2016-06-20 0 99999 7 -1 (Password locked.) [[email protected] ~]# [[email protected] ~]# passwd -u testuser --- 解锁 Unlocking password for user testuser. passwd: Success [[email protected] ~]# passwd -S testuser testuser PS 2016-06-20 0 99999 7 -1 (Password set, SHA512 crypt.) 2、使用usermod命令锁定与解锁账号 [[email protected] ~]# usermod -L testuser [[email protected] ~]# passwd -S testuser testuser LK 2016-06-20 0 99999 7 -1 (Password locked.) [[email protected] ~]# usermod -U testuser [[email protected] ~]# passwd -S testuser testuser PS 2016-06-20 0 99999 7 -1 (Password set, SHA512 crypt.) [[email protected] ~]#