- 리눅스 계정 패스워드 만료일 목록
1 전체 만료일 목록[ | ]
- 명령어
Bash
Copy
for i in `cut -f1 -d: /etc/passwd`; do echo -en "$i\t"; chage -l $i | grep -i "^password expires" | cut -d: -f2; done
- 실행예시
Console
Copy
[root@zetawiki ~]# for i in `cut -f1 -d: /etc/passwd`; do echo -en "$i\t"; chage -l $i | grep -i "^password expires" | cut -d: -f2; done
root never
bin never
... (생략)
sshd never
apache never
mysql never
2 일반사용자 만료일 목록[ | ]
- 명령어
Bash
Copy
a=$(grep ^UID_MIN /etc/login.defs | awk '{print $2}')
b=$(grep ^UID_MAX /etc/login.defs | awk '{print $2}')
for i in `awk -F':' -v "a=$a" -v "b=$b" '{ if ( $3>=a && $3<=b ) print $1}' /etc/passwd`; do echo -en "$i\t"; chage -l $i | grep -i "^password expires" | cut -d: -f2; done
3 Bash 및 일반사용자 만료일 목록[ | ]
- 명령어
Bash
Copy
a=$(grep ^UID_MIN /etc/login.defs | awk '{print $2}')
b=$(grep ^UID_MAX /etc/login.defs | awk '{print $2}')
c=$(grep /bin/bash /etc/passwd | awk -F':' '{print $3"\t"$1}')
d=$(awk -F':' -v "a=$a" -v "b=$b" '{ if ( $3>=a && $3<=b ) print $3"\t"$1}' /etc/passwd)
for i in `echo -e "$c\n$d" | sort -n | uniq | awk '{print $2}'`
do echo -en "$i"; chage -l $i | grep -i "^password expires" | cut -d: -f2
done
4 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.