오류가 발생하는 다음 명령을 sftp
사용하여 폴더에 연결 을 마운트하려고합니다 sshfs
.
~$ sshfs admin@example.com:/ testfo
remote host has disconnected
시스템에 SSH를 연결하고로 명령을 반복하면 동일한 오류가 발생합니다 localhost
. 이 명령은 다른 시스템에서도 작동하므로 문제가 서버에 있습니다.
~$ cat /var/log/auth.log
[...]
May 24 22:49:43 example sshd[20095]: Accepted publickey for admin from 24.111.222.33 port 47086 ssh2: RSA ad:xx:6e:xx:14:xx:bd:b5:xx:cb:66:xx:xx:xx:a3:ac
May 24 22:49:43 example sshd[20095]: pam_unix(sshd:session): session opened for user admin by (uid=0)
May 24 22:49:43 example systemd-logind[812]: Removed session 60.
May 24 22:49:43 example systemd-logind[812]: New session 61 of user admin.
May 24 22:49:44 example sshd[20143]: Received disconnect from 24.203.164.45: 11: disconnected by admin
May 24 22:49:44 example sshd[20095]: pam_unix(sshd:session): session closed for user admin
~/.ssh
디렉토리는 그와 유사한 문제에 대한 디버깅 시도로 I 톱 이후 관리자에 의해 소유하고 있습니다.
나중에 참조 할 수있는 추가 정보 :
문제는 없습니다 만 SFTP와 SSH를 자체. 이것은 SSH 연결이 올바르게 작동하지만 SFTP가 항상 실패한다는 사실에 의해 나타납니다. SFTP를 시도하면Received unexpected end-of-file from SFTP server
이 문제는 로그인 스크립트 출력 문자열 (예 :)과 관련 이 없습니다~/.bashrc
.
이 문제는 모든 사용자 (루트 포함)에서 발생합니다.
내 sshd 구성 ( /etc/ssh/sshd_config
) 은 다음과 같습니다 .
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp sftp-server
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
sftp-server
패키지가 설치되었습니다. ( sudo apt-get install openssh-sftp-server
)
Received unexpected end-of-file from SFTP server
sftp
다른 사용자에게 당신 은 할 수 있습니까 ? 3) sshd_config
서버에서 어떻게 생겼습니까? 4) 당신의 ~/.bashrc
모습은 어떻습니까?
which sftp-server
. 서브 시스템은이어야합니다 Subsystem sftp /usr/lib/openssh/sftp-server
. 당신은 한하십니까 sftp-server
설치되어 있습니까? apt-get install openssh-sftp-server
.
sftp
직접 갈 수 있습니까?~/.bashrc
서버의 홈 디렉토리에있는 다른 시작 파일 의 내용은 무엇입니까 ?