본문 바로가기
linux/raspberry 4B

라즈베리파이에 Remote - SSH 연결 오류 해결하기. (Failed to set up socket for dynamic port forward to remote port ?????: Socket closed. Is the remote port correct?)

by bestchoco 2022. 8. 23.

[? 문제 발생 과정]

1. VSCODE 왼쪽 하단에 원격 연결 중... 이라는 문구가 뜬 뒤 그 다음 과정으로 넘어가지 않는 현상

 

(터미널 오류 확인 결과)

[01:55:32.674] Failed to set up socket for dynamic port forward to remote port ?????: Socket closed. Is the remote port correct?
[01:55:32.717] [Forwarding server 1781] Got connection 1
[01:55:32.724] > channel 3: open failed: administratively prohibited: open failed
[01:55:32.725] Failed to set up socket for dynamic port forward to remote port ?????: Socket closed. Is the remote port correct?
[01:55:32.732] > channel 3: open failed: administratively prohibited: open failed
[01:59:32.756] ------
[01:59:32.756] SSH Resolver called for "ssh-remote+?????", attempt 2, (Reconnection)
[01:59:32.757] SSH Resolver called for host: ?????
[01:59:32.757] Setting up SSH remote "?????"
[01:59:32.758] Using commit id "--------------------------------------------" and quality "stable" for server
[01:59:32.761] Install and start server if needed
[01:59:32.764] Running script with connection command: ssh -T -D 1843 ????? bash
[01:59:32.765] Terminal shell path: C:\Windows\System32\cmd.exe
[01:59:33.077] > ?????@?????'s password:]0;C:\Windows\System32\cmd.exe
[01:59:33.078] Got some output, clearing connection timeout
[01:59:33.078] Showing password prompt

[! 문제 해결 과정]

1. https://github.com/microsoft/vscode-remote-release/issues/4683#issuecomment-1059753371

 

Failed to set up socket for dynamic port forward to remote port 33833 · Issue #4683 · microsoft/vscode-remote-release

I am using remote-ssh to connect to a virtual machine. The connection keeps failing with a failed to set up socket for dynamic port and hangs. Any idea what this error may be? [21:44:34.378] Log Le...

github.com

위의 링크 참조하여 PUTTY 프로그램으로 SSH 접속 후 아래의 사항을 변경 후 저장.

 

- 터미널에 sudo vi /etc/ssh/sshd_config 입력. 

 

~~~(파일 열리면 여러 항목이 입력되어 있다. 그 중 AllowTcpForwarding을 no에서 yes로 변경)~~~

...

AllowTcpForwarding yes

...

 

- 수정 완료 후 저장, 다시 터미널 입력 창에서 service ssh restart 입력.

 

3. 다시 VSCODE 창에서 원격 접속 후 이상없이 접속됨을 확인할 수 있다.