# 로그확인
$ sudo last -f /var/log/btmp | more
# 로그인에 실패한 로그 확인
$ sudo grep Failed /var/log/auth* | head
$ sudo grep Failed /var/log/auth.log.1 | tail
# 로그인에 실패한 횟수
$ sudo grep Failed /var/log/auth* | wc -l
# 공격시도가 가장 많은 IP 순
$ grep authentication /var/log/auth* | cut -d'=' -f7 | cut -d' ' -f1 | sort | uniq -c | sort -r
# 로그출력
tail -f auth.log
# ssh 포트 변경
$ sudo vi /etc/ssh/sshd_config
## Port 22
Port 3022
$ sudo systemctl restart sshd (Centos)
$ sudo systemctl restart ssh (Ubuntu)
# ip 차단
# 현재관리 ip리스트 확인
$ route
# ip 차단하기
$ sudo route add -host (도메인 or ip) reject
# ip 차단 해제하기
$ sudo route del -host (도메인 or ip) reject
# ip 주소 추적 사이트
https://nordvpn.com/ko/ip-lookup/
'Infra Structure > Linux' 카테고리의 다른 글
[Ubuntu] 방화벽 (0) | 2025.03.03 |
---|---|
[Linux] ttyd 설치 (0) | 2022.10.31 |
[Linux] 포트 오픈 확인 (nc 간이 서버 구축 / telnet) (0) | 2022.10.28 |
vi 찾아 바꾸기 (0) | 2022.10.27 |
[Ubuntu] OpenJDK offline 설치하기 (0) | 2022.10.23 |