SSH 포트 포워딩이 작동하지 않습니다. 에러 발생됨

SSH 포트 포워딩이 작동하지 않습니다. 에러 발생됨

나는 (ssh 명령을 실행하여) 원격 서버에 의해 제어되어야 하는 로컬 랩톱 MacOS를 localmac가지고 있습니다 .macuserremotelinuxlinuxuser

나는 localmac성공할 수 있다ssh linuxuser@remotelinux

내 경우에는 localmac다음을 사용하여 터널을 게시했습니다.

ssh -fnN -R 4444:localhost:22  linuxuser@remotelinux

이제 remotelinux다음 명령을 사용하여 키를 복사하려고 하는데 오류가 발생합니다.

$ ssh-copy-id -p 4444 macuser@localhost
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/linuxuser/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: ERROR: ssh_exchange_identification: Connection closed by remote host

위의 방법이 실패했다는 것을 알고 있지만 다음과 같이 RemoteLinux에서 호스트 이름 명령을 트리거해 보았습니다.

[linuxuser@remotelinux ~]$ ssh -p 3334 macuser@localhost 'hostname' -vvvv
ssh_exchange_identification: Connection closed by remote host
[linuxuser@remotelinux ~]$ ssh -p 3334 macuser@localhost -vvvv
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug2: resolving "localhost" port 3334
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to localhost [::1] port 3334.
debug1: Connection established.
debug1: identity file /home/linuxuser/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/linuxuser/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/linuxuser/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/linuxuser/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/linuxuser/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/linuxuser/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/linuxuser/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/linuxuser/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
ssh_exchange_identification: Connection closed by remote host

localmac내가 실행한 모든 SSH 명령에 대해 다음 메시지가 인쇄되는 것을 발견했습니다 .remotelinux

SSH tunneling: connect_to localhost port 22: failed

작동시키는 방법을 제안해 주실 수 있나요?

답변1

MacOS 노트북에서는 원격 로그인이 기본적으로 비활성화되어 있으므로 SSH가 실패합니다. 환경 설정으로 이동하여 활성화하십시오.

관련 정보