ssh无法连接到远端Ubuntu的解决方法
2016-12-03 00:00
288 查看
ssh无法连接到远端Ubuntu的解决方法
2014-10-16 0 个评论 来源:KiteRunner的专栏
收藏
![](https://static.oschina.net/uploads/img/201612/03144725_SgVp.jpg)
我要投稿
近日,饱受无法远程登录到新安装在VMWare上的Ubuntu虚拟机,如今发现问题所在,故记录此问题的解决方案,以备后用。
关于配置网卡,可在VMWare的Edit->Virtual Network Editor中进行相关配置。
p.s.在Ubuntu系统中,可以使用命令#ifup {interface}和#ifdown {interface}来打开和关闭相关网卡。但是,如果以ifconfig eth0来设置或者是修改了网络接口后,就无法再以ifdown eth0的方式来关闭了。因为ifdown会分析比较目前的网络参数与ifcfg-eth0是否相符,如果不符的话,就会放弃这次操作。因此,使用ifconfig修改完毕后,应该要以ifconfig eth0 down才能够关闭该接口。
安装命令:sudo apt-get install openssh-server.
sudo /etc/init.d/ssh restart(重新启动ssh服务)
具体可参考:Ubuntu下安装OpenSSH Server并在客户端远程连接Ubuntu
现在,安装好openssh-server后,可以运行命令:netstat -an | grep 22 或 ps -e |grep ssh
查看22端口是否处于LISTEN状态或ssh服务是否已经运行,如果是,则说明Ubuntu主机上的ssh已经配置好了。
p.s.
1、为了在xshell中正常的显示中文,我们要把xshell编码方式改成utf8。具体操作为:
[file]–>[open]–>在打开的session中选择连接,点击[properties] -> [Terminal ] ,在右边的translation先选择utf8,然后重新连接服务器即可。
2、如何将windwos上的文件传输到虚拟机上的linux 上
法一:
输入rz –help
如果出现程序“rz”尚未安装。 您可以使用以下命令安装:
sudo apt-get install lrzsz
切换到你要存放文件的目录
File->Transfer->Send ZMODEM,出现一个对话框,选择你要传输的文件就可以了。
法二:
使用pscp(putty的一个绑定程序)来实现文件传输。
另外,个人谈谈采用远程登录方法的一些好处:
1、可以个性化配置终端;
2、虚拟机不必运行在图形界面;
3、操作简单,如同在系统终端上操作一样;
4、传输文件很简单,另外,可以使用粘贴复制,这是很方便的。
附:
Fire this command:
If you see that no traffic is allowed (i.e. no specific rules), then run the following command:
this command tells the system to allow incoming connections to port 22...and usually should solve your dilemma, specifically for
UPDATED as of July 31,2016: iptables have nothing to do with ssh as an application, but on other hand, functions as router in allow the traffic to port 22. When using iptables, the system actually understand 'ssh' however, it's a shortcut within command line but, really, it's actually
2014-10-16 0 个评论 来源:KiteRunner的专栏
收藏
![](https://static.oschina.net/uploads/img/201612/03144725_SgVp.jpg)
我要投稿
近日,饱受无法远程登录到新安装在VMWare上的Ubuntu虚拟机,如今发现问题所在,故记录此问题的解决方案,以备后用。
一、远程登录虚拟机的准备:
Ubuntu虚拟机的联网方式应该选择Bridged(桥接模式),可以在Ubuntu中配置静态IP,或者使用路由器(自己使用的是WiFi连接,经过无线路由器进行配置)通过DCHP服务器进行IP地址分配(一般配置后不再改变,通过MAC地址识别来分配地址,除非IP地址已经耗尽)。关于VMWare的几种联网方式,可以参考:vmware中的bridge、nat、host-only的区别关于配置网卡,可在VMWare的Edit->Virtual Network Editor中进行相关配置。
p.s.在Ubuntu系统中,可以使用命令#ifup {interface}和#ifdown {interface}来打开和关闭相关网卡。但是,如果以ifconfig eth0来设置或者是修改了网络接口后,就无法再以ifdown eth0的方式来关闭了。因为ifdown会分析比较目前的网络参数与ifcfg-eth0是否相符,如果不符的话,就会放弃这次操作。因此,使用ifconfig修改完毕后,应该要以ifconfig eth0 down才能够关闭该接口。
二、关于远端主机(Ubuntu)上的一些配置:
必须安装openssh-server软件,这样才可以通过ssh连接到Ubuntu虚拟机。安装命令:sudo apt-get install openssh-server.
sudo /etc/init.d/ssh restart(重新启动ssh服务)
具体可参考:Ubuntu下安装OpenSSH Server并在客户端远程连接Ubuntu
现在,安装好openssh-server后,可以运行命令:netstat -an | grep 22 或 ps -e |grep ssh
查看22端口是否处于LISTEN状态或ssh服务是否已经运行,如果是,则说明Ubuntu主机上的ssh已经配置好了。
三、XShell连接到远端主机Ubuntu:
依照提示,逐步配置,端口号选择22,进行个性化配置后,即可进行远程登录。p.s.
1、为了在xshell中正常的显示中文,我们要把xshell编码方式改成utf8。具体操作为:
[file]–>[open]–>在打开的session中选择连接,点击[properties] -> [Terminal ] ,在右边的translation先选择utf8,然后重新连接服务器即可。
2、如何将windwos上的文件传输到虚拟机上的linux 上
法一:
输入rz –help
如果出现程序“rz”尚未安装。 您可以使用以下命令安装:
sudo apt-get install lrzsz
切换到你要存放文件的目录
File->Transfer->Send ZMODEM,出现一个对话框,选择你要传输的文件就可以了。
法二:
使用pscp(putty的一个绑定程序)来实现文件传输。
另外,个人谈谈采用远程登录方法的一些好处:
1、可以个性化配置终端;
2、虚拟机不必运行在图形界面;
3、操作简单,如同在系统终端上操作一样;
4、传输文件很简单,另外,可以使用粘贴复制,这是很方便的。
附:
Fire this command:
sudo iptables -L
If you see that no traffic is allowed (i.e. no specific rules), then run the following command:
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
this command tells the system to allow incoming connections to port 22...and usually should solve your dilemma, specifically for
ssh/
sshd.
UPDATED as of July 31,2016: iptables have nothing to do with ssh as an application, but on other hand, functions as router in allow the traffic to port 22. When using iptables, the system actually understand 'ssh' however, it's a shortcut within command line but, really, it's actually
iptables INPUT -p udp -dport 22while --dport means "destination port" (ssh uses port 22). This probably caused some misconception on seeing 'ssh' as if it's an appication, but really '22' as port.
相关文章推荐
- ssh无法连接到远端Ubuntu的解决方法
- ssh无法连接到远端Ubuntu的解决方法
- Ubuntu 16.04下安装ssh远程无法连接的解决方法
- Ubuntu 16.04下安装ssh远程无法连接的解决方法
- WinSCP无法连接 ubuntu 的解决方法
- Ubuntu12.04下adb无法识别设备 Ubuntu下adb看不到设备的解决方法 博客分类: ubuntu 这个问题纠结了我2天,本来过去在ubuntu 9下连接HTC
- ubuntu出现有线已连接却无法上网的解决方法(ubuntu连不上网)
- 解决ubuntu下ssh无法连接
- Ubuntu16.04 解决 LNMP 一键安装包 MySQL 无法远程连接的方法
- Ubuntu 配置VNC以及使用VNC连接时,无法显示系统菜单栏,解决方法
- 解决Ubuntu中无法连接wifi的方法
- VMware下ubuntu系统一直莫名其妙地连接无线网络导致Hadoop集群无法正常启动的解决方法
- Ubuntu终端ssh连接服务器慢的解决方法
- ubuntu出现有线已连接却无法上网的解决方法(ubuntu连不上网)
- Ubuntu安装Dropbox后无法连接服务器的解决方法
- LinuxMint 15 / Ubuntu 13.04 / Ubuntu 13.10 下无法连接 wpa2 enterprise 加密无线网络的解决方法
- Xshell用ssh连接ubuntu掉线解决方法
- Xshell用ssh连接ubuntu掉线解决方法
- ssh客户端无法连接Ubuntu15.04的解决办法
- Xshell用ssh连接ubuntu掉线解决方法