Centos7 scp: Connection closed
背景:因Centos7.9安装后openssh和openssl存在漏洞。因此将openssh和openssl升级后文件丢失导致scp报错无法使用。
1 debug1: channel 0: new session [client-session] (inactive timeout: 0) 2 debug1: Requesting no-more-sessions@openssh.com 3 debug1: Entering interactive session. 4 debug1: pledge: filesystem 5 debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0 6 debug1: client_input_hostkeys: searching /root/.ssh/known_hosts for 192.168.40.200 / (none) 7 debug1: client_input_hostkeys: searching /root/.ssh/known_hosts2 for 192.168.40.200 / (none) 8 debug1: client_input_hostkeys: hostkeys file /root/.ssh/known_hosts2 does not exist 9 debug1: client_input_hostkeys: no new or deprecated keys from server 10 debug1: Sending subsystem: sftp 11 debug1: pledge: fork 12 debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 13 debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0 14 debug1: channel 0: free: client-session, nchannels 1 15 Transferred: sent 3208, received 3380 bytes, in 0.1 seconds 16 Bytes per second: sent 35608.8, received 37518.0 17 debug1: Exit status 127 18 debug1: compress outgoing: raw data 141, compressed 123, factor 0.87 19 debug1: compress incoming: raw data 566, compressed 538, factor 0.95 20 scp: Connection closed 21 [root@localhost ~]# egrep -v '^$|#' /etc/ssh/sshd_config |sort 22 AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES 23 AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE 24 AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT 25 AcceptEnv XMODIFIERS 26 AuthorizedKeysFile .ssh/authorized_keys 27 ChallengeResponseAuthentication no 28 HostKey /etc/ssh/ssh_host_ecdsa_key 29 HostKey /etc/ssh/ssh_host_ed25519_key 30 HostKey /etc/ssh/ssh_host_rsa_key 31 PasswordAuthentication yes 32 PermitRootLogin yes 33 Subsystem sftp /usr/libexec/openssh/sftp-server 34 SyslogFacility AUTHPRIV 35 UseDNS no 36 UsePAM yes 37 [root@l-smart-psu-pro-cq-cs webapp]# ll /usr/libexec/openssh/sftp-server 38 ls: 无法访问/usr/libexec/openssh/sftp-server: 没有那个文件或目录
debug1: Exit status 127:这行信息显示了scp命令的退出状态码为127,通常意味着无法找到要执行的程序(例如,服务器端没有正确配置sftp-server
解决:
进入编译之后的openssh路径下。执行:
mkdir -p /usr/libexec/openssh/ && cp ./openssh-9.3p1/sftp-server /usr/libexec/openssh/

浙公网安备 33010602011771号