Ubuntu14.04解决ssh登录不上

新装了一个VMware虚拟机,Ubuntu14.04LTS版本。

ssh登录,有时候登录不上,有时候能登上。

前提:确保网络连通
在windows和ubuntu上相互ping 是否能通
桥接和nat

解决办法:
(1)查看ip地址是否冲突
我在单位的虚拟机ip地址是192.168.0.102与其它机器冲突了。改成了192.168.14.83

(2)关闭Ubuntu14.04的防火墙

root@stgman-desktop:~# sudo ufw disable

防火墙在系统启动时自动禁用


(3)Ubuntu系统上安装、启动sshd服务

sudo apt-get install openssh-server

sudo /etc/init.d/ssh restart 

【对于CentOS系统,启动sshd服务,请参考】http://blog.csdn.net/fenglailea/article/details/12191607


(4)ssh还不能登录上,就修改sshd的默认配置

ssh出现permission denied(publickey)问题:


扫描二维码关注公众号,回复: 4855593 查看本文章

修改/etc/ssh/sshd-config文件.


将其中的PermitRootLogin no修改为yes


PubkeyAuthentication yes修改为no


AuthorizedKeysFile.ssh/authorized_keys前面加上#屏蔽掉,


PasswordAuthenticationno修改为yes就可以了。


/etc/ssh/sshd-config文件
Subsystem       sftp    /usr/libexec/openssh/sftp-server
Port 22
Protocol 2
PermitRootLogin no
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
#CACertificateFile  /etc/ssh/ca/ca.cert
PasswordAuthentication no
PermitEmptyPasswords no
PrintMotd no
ChallengeResponseAuthentication no
UseDNS no
ClientAliveInterval 60

 

win7上ssh客户端,可以使用SSH Secure Shell 或者 SecureCRT文件

猜你喜欢

转载自blog.csdn.net/jerryDzan/article/details/75873636