putty连接linux as5 输入密码后连接中断

时间:2023-03-08 22:51:18
putty连接linux as5 输入密码后连接中断

putty连接linux as5 输入密码后连接中断

1、修改putty首页的设置,选择“close session on exit” 为 “never”,之后发现输入密码后,“session closed by remote host”。

2、查看var/log/secure , 发现在每次 密码接受 “Accepted password for root from ******* port 1897 ssh2”之后,都报了一个“fatal: bad ownership or modes for chroot directory "/usr/nginx/img/img1"”

3、初步怀疑是某文件夹权限冲突,于是匆匆的修改了这个目录的归属用户 sftp为root

4、错误还有,但是报错变为  "bin/bash:no sucn file or directory",用无法登陆的用户名,则报“sbin/nologin:no sucn file or directory”

由于百度得到的答案,大多集中在 shell命令的dos/unix文本格式问题,所以这一步耗费了不少时间。

5、问题解决,http://*.com/questions/12619689/ssh-through-putty-comes-up-with-a-no-such-file-or-directory

“Check your /etc/ssh/sshd_config to make sure that you don't have a chroot directory set. If you do, you will need to either create a bin directory in the chroot directory and either copy or link the necessary binaries into that directory.”

注释掉/etc/ssh/sshd_config中的chroot一行。

原因分析,之前在架设完服务器以后,尝试了一把sftp,顺手就按照操作说明,用chroot修改为了允许远程用户访问限制在某个文件夹为根目录上。由于SSH登陆以为该设定是根目录,所以找不到 bin/bash。于是登陆失败。

应该有更为完美的办法,以后再说吧