ユーザがログインできないとき

小ネタです。

なんかしらの原因でログインできないときの確認方法と解除方法です。

前に、ユーザ管理をやりましたが補足です。

linlinrh.hatenadiary.jp

アカウントロックの場合

ロックがかかっていないかを確認します。

[root@host1 ~]# passwd -S mary
mary LK 2018-01-12 0 99999 7 -1 (Password locked.)
[root@host1 ~]#

ロックされていると、lockedになります。

 

アンロックします。
[root@host1 ~]# passwd -u mary
Unlocking password for user mary.
passwd: Success
[root@host1 ~]#

ロックが解除されたか確認します。
[root@host1 ~]# passwd -S mary
mary PS 2018-01-12 0 99999 7 -1 (Password set, SHA512 crypt.)
[root@host1 ~]#

setに変わってロックが解除されます。

 

ユーザの利用期限を超えている場合

ユーザがどんな状況になっているかを、rootでログインして確認してみます。chageコマンドの-lオプションでみてみると。

[root@host1 ~]# chage -l hanako
Last password change : Jan 12, 2018
Password expires : never
Password inactive : never
Account expires : Dec 31, 2017
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
[root@host1 ~]#

2017年の大晦日にアカウント期限が切れています。

 

解除するには、-Eオプションに-1を指定します。


[root@host1 ~]# chage -E -1 hanako

 

もう一度確認してみます。
[root@host1 ~]# chage -l hanako
Last password change : Jan 12, 2018
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
[root@host1 ~]#

neverになりまして復活です。

 

ではでは。