티스토리 뷰
반응형
#!/bin/bash
today=$(date +%Y%m%d')
rbashuser=$(cat /etc/passwd |grep rbash |awk 'BEGIN {FS = ":"} {print $1}'|egrep -v "root|nike|secupang")
for user in $rbashuser
do
auser=$user
buser=$(lastlog -u $user |grep $user |awk '{print $1}')
#buser=$(lastlog -b 90 -u $user |grep $user |awk '{print $1}')
if [ "$auser" != "$buser" ]
then
echo $auser login !!
else
echo $auser nologin 90day change nologin mode !! >> /var/logs/$today-nologin.log
chsh -s /sbin/nologin $auser
fi
done반응형
'linux' 카테고리의 다른 글
| grub2 설정 변경 (0) | 2023.11.30 |
|---|---|
| linux 유저 생성 스크립트 (0) | 2023.11.01 |
| linux 90 days no login users change nologin mode! bash scripts (0) | 2023.10.21 |
| logstash pipline output (0) | 2023.06.14 |
| How to fix "pvs shows unknown device" (1) | 2023.05.16 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- cmd로 계정 생성
- dl20
- ISCSI 볼륨 RAC
- chrony
- oracle linux8 kernel
- windows.old 강제삭제
- ansible network
- centos7 ntp
- nxos ansible
- dl20 g9 centos7 설치
- 특정 문구 치환
- 윈도우서버 계정 관려
- 윈도우 cmd 계정 관리
- shell connmad log
- DL20 GEN9 장비에 CentOS 7
- kernel 변경
- cmd로 윈도우 계정 관리
- vm rac
- linux command log
- nutanix rac
- cgroup
- ios ansible
- ILO
- cisco ansible
- ansible ios
- CentOS 7 GUI
- 리눅스 커맨드 로그남기기
- dl20 centos7
- 특정 라인삭제
- ipmi
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함
