プロキシサーバーを使用して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

おすすめ記事