服务器环境:操作系统:ubuntu 14.04 64bit
客户端环境:deepin 64bit
服务器端设置:
1.执行以下命令,将“/etc/ssh/sshd_config”中的“PasswordAuthentication”值修改为“yes”。
sudo vi /etc/ssh/sshd_config
2.执行以下命令,重新加载sshd服务。
sudo service sshd reload
3.为安全起见,建议重置Linux弹性云服务器普通帐户的密码 执行以下命令,重置用户名为“linux”的弹性云服务器密码。sudo passwd linux
4.按照回显提示,输入新密码,按“Enter”5.重新输入设置的新密码,按“Enter”。
6.系统回显如下时,表明重置成功。
passwd: all authentication tokens updated successfully.
客户端:
客户端通过ssh方式连接服务器出错,官网提供的登陆格式如下:
lsj@lsj-pc:~$ ssh 122.112.224.189
ssh_exchange_identification: read: Connection reset by peer
连接后报错
ping 服务器发现网络连接正常
PING 122.112.224.166 (122.112.224.189) 56(84) bytes of data.
64 bytes from 122.112.224.189: icmp_seq=1 ttl=32 time=45.9 ms
64 bytes from 122.112.224.189: icmp_seq=2 ttl=32 time=73.0 ms
64 bytes from 122.112.224.189: icmp_seq=3 ttl=32 time=43.7 ms
用ssh -v去连有问题的服务器,会有比较详细的调试信息在屏幕上输出,可以帮助判断是哪一步出了问题。lsj@lsj-pc:~$ ssh -v 122.112.224.189
OpenSSH_7.3p1 Debian-3+b1, OpenSSL 1.0.2j 26 Sep 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 122.112.224.189 [122.112.224.189] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/lsj/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/lsj/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/lsj/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/lsj/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/lsj/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/lsj/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/lsj/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/lsj/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3p1 Debian-3+b1
提示路径不正确??
解决方案:
用root身份登陆服务器:
lsj@lsj-pc:~$ ssh root@122.112.224.189
输入root密码