connection reset by port 22 - SSH Server connection drops out after few minutes of inactivity

김재영·2021년 4월 16일
0

os: ubuntu18.04

윈도우에서 ssh 연결 후 아무런 작업도 하지 않는 상태로 두면 connection reset by port 22 라는 명령어가 등장하면서 ssh 연결이 끊어지는 현상이 발생했다.

이때 윈도우에서 해결방법

1. client

ssh_config 파일을 만들어야 하는데 default 로 ssh 연결시
C:\Users\yourusername\.ssh
위 경로를 참고함 따라서 .ssh 폴더 하위에 ssh_config 파일을 만들어주고 ssh_config 파일에 아래와 같이 입력해준다.

Host *
ServerAliveInterval 15
ServerAliveCountMax 3

2. remote server

sudo vi /etc/ssh/sshd_config
들어가서 아래와 같이 변경

ClientAliveInterval 30
ClientAliveCountMax 5

그리고 마지막으로 sudo etc/init.d/ssh restart 해주면 된다.

0개의 댓글