ssh连不上vmware虚拟机ubuntu9.10 ubuntu10.10

用Vmware新装了ubuntu9.10虚拟机虚拟机之后,先配置虚拟机的网络。

host XP能ping通ubuntu, ubuntu能ping通局域网内除了host之外的其它所有PC机、能ping通网关。

但是在XP上ssh总是连不上ubuntu虚拟机。

google一下"ssh: connect to host localhost port 22: Connection refused",找到解决办法:

(1)http://ubuntuforums.org/showthread.php?t=662538

在虚拟机上试一下,能不能ssh自连,CMD:

Re: ssh on vmware

can you, on the server, ssh into itself?

Code:
 ssh root@localhost 
linux@ubuntu:~$ ssh  root@localhost
ssh: connect to host localhost port 22: Connection refused
说明默认的ubuntu9.10-desktop没有安装ssh服务,安装ssh服务、并启动。
linux@ubuntu:~$ sudo apt-get install openssh-server
linux@ubuntu:~$ sudo /etc/init.d/ssh start
 * Starting OpenBSD Secure Shell server sshd    
XP上再连该虚拟机,ssh能连上了。

(2)http://thasulinux.wordpress.com/2011/04/01/solution-for-ssh-connect-to-host-localhost-port-22-connection-refused/

Solution for “ssh: connect to host localhost port 22: Connection refused”

Posted on  April 1, 2011 by  Tha.Suresh1 Comment

Hi friends,

Since three days, i had problem with my ssh connection. When i was tried to connect my laptop to others machine,  I’m able to connect with them. But when i tried to connect, others machine to my laptop, I got this Error.

[student@mercury ~]$ ssh suresh@192.168.1.9
ssh: connect to host 192.168.1.9 port 22: Connection refused

Solution for this “port 22: Connection refused” :

First check if sshd is running by trying the command ‘$ pgrep sshd
on the host. If the output is empty, its very likely that sshd is not
running. Try ‘tail -f /var/log/messages’ on one terminal and do
a ‘$ /etc/init.d/sshd start‘ on another terminal.  Then, check the
output that comes up on the previous terminal.

 

if PID comes, like 1702(any number), we conform the “sshd” is running.

Next, we have to flush the “iptables” by using the following command,

$ sudo iptables -F

That’s all. Now you can connect with anyone via ssh.

If again the same problem appear, Try ‘grep sshd /var/log/messages | tail‘ and
‘$ grep ssh /var/log/secure | tail‘ and check for any possible issues.


转载自http://blog.csdn.net/wangzhong1979/article/details/6461241

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值