我正在为一个客户开发一个项目,我们在主机上使用多个 docker 容器。我需要将一些文件从我的计算机复制到主机,但是当使用 SFTP 客户端 (cyberduck) 时,我无法连接到服务器。
该地址有多个@
,这可能是我无法连接的原因?
SSH命令是这样的:
ssh username@name@[email protected]
我尝试将用户名放入 SFTP 客户端username@name@identifier
和服务器中domain.com
,但仍然无法连接。
这可能吗?我可以通过主机的终端检查是否能够 sftp 到主机吗?
通过 SSH:ing 进入服务器时登录
OpenSSH_7.7p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to domain.com port 22.
debug1: Connection established.
debug1: identity file /Users/user/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: Local version string SSH-2.0-OpenSSH_7.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.3
debug1: match: OpenSSH_7.3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to domain.com:22 as 'username@name@identifier'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-******
debug1: kex: server->client cipher: ****-poly***@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: *****-poly***@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ***********
debug1: Host 'domain.com' is known and matches the ECDSA host key.
debug1: Found key in /Users/user/.ssh/known_hosts:16
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:******* /Users/user/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /Users/user/.ssh/id_dsa
debug1: Trying private key: /Users/user/.ssh/id_ecdsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
username@name@[email protected]'s password:
debug1: Authentication succeeded (password).
Authenticated to domain.com ([12.345.678.9101]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Sending environment.
debug1: Sending env LC_CTYPE = UTF-8
This session is being recorded
Using username "other_username".
LEGAL NOTICE
------------
This is a PRIVATE computer system.
All unauthorized use or unauthorized access is prohibited
according to local laws and may lead to prosecution.
从终端进行 SFTP:ing 时记录
Authenticated to Authenticated to domain.com ([12.345.678.9101]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Sending environment.
debug1: Sending env LC_CTYPE = UTF-8
debug1: Sending subsystem: sftp
subsystem request failed on channel 0
Connection closed
答案1
我不得不修改旧的/etc/ssh/sshd_config
.我添加了以下内容并重新启动了机器:
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
# override default of no subsystems
Subsystem sftp /usr/lib/openssh/sftp-server
答案2
我遇到了同样的问题,最终将子系统行添加到 /etc/ssh/sshd_config 中,然后重新加载 sshd 服务。这为我解决了。我的设置是 Xubuntu 20.04 的普通安装