您的位置:首页 > 运维架构 > Linux

putty 连接linux失败---解决方案

2015-12-05 21:38 519 查看
在VMware中安装Ubuntu之后,主机可以ping通虚拟机,想用putty来连接,结果返回: Authentication refused。

如下为解决方案:

1.在Ubuntu上查看ssh服务是否开启, ps -ef|grep ssh

2.发现没有开启ssh,试图开启ssh, service ssh start(无法开启ssh,因为没有安装ssh server 和 client)

3.获取ssh server和client 安装包,apt update(返回很多404错误,说明有很多网址无法打开)

4.在网络上搜寻可用的源列表(source.list 位置为:/etc/apt/sources.list),例如163的源列表

deb http://mirrors.163.com/ubuntu/ quantal main universe restricted multiverse

deb-src http://mirrors.163.com/ubuntu/ quantal main universe restricted multiverse

deb http://mirrors.163.com/ubuntu/ quantal-security universe main multiverse restricted

deb-src http://mirrors.163.com/ubuntu/ quantal-security universe main multiverse restricted

deb http://mirrors.163.com/ubuntu/ quantal-updates universe main multiverse restricted

deb http://mirrors.163.com/ubuntu/ quantal-proposed universe main multiverse restricted

deb-src http://mirrors.163.com/ubuntu/ quantal-proposed universe main multiverse restricted

deb http://mirrors.163.com/ubuntu/ quantal-backports universe main multiverse restricted

deb-src http://mirrors.163.com/ubuntu/ quantal-backports universe main multiverse restricted

deb-src http://mirrors.163.com/ubuntu/ quantal-updates universe main multiverse restricted

为原来的sources.list做备份,然后更新源列表,做 update(apt update),仍然发现很多404错误(这是因为源列 表的目录已经更改,即quantal目录已经不存在)

5.进入http://mirrors.163.com/ubuntu/dists 查看发现quantal已经不再存在,而lucid目录存在(如下图所示),并且有与quantal对应的文件和目录,将source.list中quantal全部替换为lucid。



6.做update(apt update)

7.安装ssh server和client, sudo apt-get install openssh-server;sudo apt-get install openssh-client

8.开启ssh服务, etc/init.d/ssh start

9.查看ssh服务状态 ps -ef|grep ssh,发现进程已起

10.putty 连接Ubuntu成功
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: