Ubuntu 服务器登录成功后关闭连接

Ubuntu 服务器登录成功后关闭连接

我无法通过 WinSCP 或 sftp 登录我的 Ubuntu (12.04 LTS) 服务器。之前 /etc/ssh 中的 ssh_host_* 文件存在权限问题。这是在我尝试从另一个目录执行 chmod -R 之后发生的,这显然也更改了其他一些文件的权限。

我尝试过sftp -P port-vv username@serverip,得到以下输出。

debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
Authenticated to ***** 
debug2: fd 4 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: fd 3 setting TCP_NODELAY
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending subsystem: sftp
debug2: channel 0: request subsystem confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: subsystem request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: rcvd close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 1952, received 1960 bytes, in 0.3 seconds
Bytes per second: sent 6473.8, received 6500.3
debug1: Exit status 141

答案1

  • 确保您的 ~/.profile(或您特定 shell 的等效文件)不会生成任何输出。

  • 确保 sshd_config 指向有效的 sftp 二进制文件

答案2

要重置文件权限,我使用了以下链接,它成功地将所有权限更改为其默认权限 http://sysadminnotebook.blogspot.in/2012/06/how-to-reset-folder-permissions-to.html

相关内容