프록시 서버를 사용하여 SFTP와 연결

프록시 서버를 사용하여 SFTP와 연결

다음 명령을 사용하여 프록시를 사용하여 외부 서버에 연결하려고 합니다.

sftp -v -o "ProxyCommand /usr/bin/nc -X connect -x proxyserver.com:8080 %h %p" [email protected]

이것은 작동하지 않습니다. 다음과 같은 결과가 나타납니다.

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: Applying options for *

debug1: Executing proxy command: exec /usr/bin/nc -X connect -x proxyserver.com:8080 [email protected]

debug1: permanently_drop_suid: 456876
bash: No such file or directory

명령 형식이 올바른 것 같은데 "permanently_drop_suid" 단계에서 실패한 것 같습니다. 여기서 무엇이 잘못될 수 있는지 아는 사람이 있나요? WinSCP를 사용하여 연결할 수 있으므로 연결 세부 정보가 정확합니다. 어떤 도움이라도 대단히 감사하겠습니다!

답변1

마지막 메시지는 bash: No such file or directory리모컨이 bash실행할 바이너리를 찾을 수 없음을 의미합니다. 따라서 이는 원격 측의 구성 문제일 수 있습니다.

다른 사용자를 사용하여 server.com에 연결해 보거나 활성 셸에 대한 원격 "user@server" 설정을 확인해 보시겠습니까?

또한 원격으로 SSH를 통해 연결할 수 있습니까? ssh -o ProxyCommand... user@server?

이제 비슷한 문제에 직면하고 있으며 이것이 내 결과입니다.

$ sftp -v -o ConnectTimeout=3 \
    -o ProxyCommand='/usr/bin/nc -X connect -x proxyserver.com:8080 %h %p' \
    -oPort=443 user@server

Connecting to server...
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Executing proxy command: exec /usr/bin/nc -X connect -x proxyserver.com:8080 server 443
[...]
debug1: permanently_drop_suid: 21889
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: checking without port identifier
The authenticity of host '[server]:443 (<no hostip for proxy command>)' can't be established.
RSA  key fingerprint is <the_finger_print>.
Are you sure you want to continue connecting (yes/no)? ^C

답변2

op 명령에는 2가지 문제가 있습니다. 형식이 잘못되었고 포트 번호가 누락되었습니다... 원본: sftp -v -o "ProxyCommand /usr/bin/nc -X connect -x Proxyserver.com:8080 %h %p"[이메일 보호됨]

정정: sftp -v -o ProxyCommand="/usr/bin/nc -X connect -x Proxyserver.com:8080 %h %p"[이메일 보호됨]999(대상 호스트에 필요한 모든 포트 번호)

관련 정보