1
zunxiongchen 2020-09-03 11:06:32 +08:00
试下这个吧
#!/bin/bash export LANG="en_US.UTF-8" USER=$(grep "/bin/bash" /etc/passwd | awk -F ":" '{print $1}') echo "Username:PasswordExpires:LastPasswordChangeDate" for TIME in $USER do echo -e "$TIME:\c" PX=`chage -l $TIME | grep -w "Password expires" | awk -F ":" '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//'` echo -e "$PX:\c" chage -l $TIME | grep -w "Last password change" | awk -F ":" '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//' done |
2
king1688888888 OP @zunxiongchen 感谢分享,我参考着改一下。
|
3
zunxiongchen 2020-09-03 11:48:37 +08:00
|
4
sjhspp 2020-09-03 11:50:27 +08:00
看到了长大的自己
|
5
UnknownR 2020-09-03 12:25:26 +08:00
每次到这个时候就会怀念 powershell 这种 oop 脚本的方便性
|
6
hasdream 2020-09-03 12:35:15 +08:00 1
import spwd
root_shadow = spwd.getspnam("root") print root_shadow.sp_expire #过期时间 print root_shadow.sp_lstchg #上次修改密码时间 |