在ssh中遇到过main考过科二个成功页面几时消失在页面不考过科二个成功页面几时消失的吗

在Ubuntu中ssh报错: connect to host localhost port 22: Connection refused 解决办法
发布时间: 16:17:13
& & &本人最近在Ubuntu 14.04上搭建Hadoop 2.5伪分布集群时偶然遇见ssh: connect to host localhost port 22: Connection refused 问题,尝试多种办法,最终得以解决,下面由我细细道来~~
& & & 安装既定步骤进行完hadoop相关配置后,运行$ ./sbin/start-dfs.sh命令时终端显示如下:
./sbin/start-dfs.sh
Starting namenodes on [localhost] localhost: ssh: connect to host localhost port 22: Connection refused localhost: ssh: connect to host localhost port 22: Connection refused Starting secondary namenodes [0.0.0.0] 0.0.0.0: ssh: connect to host 0.0.0.0 port 22: Connection refused&&
& & & 怀疑ssh服务未启动,于是$ service sshd restart
service sshd restart sshd: unrecognized service
& & & 居然没有sshd服务,于是查了一下,本机初始状态安装的是openssh, 也不存在/etc/init.d/ssh这玩意儿,不能忍。于是怀疑本机22端口未开启,于是:
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT ?
ssh localhost
ssh: connect to host localhost port 22: Connection refused
& & & &还是不行!果断Google了一番(嘿嘿,个人热衷Google搜索,某度不敢恭维,在天朝当然得翻墙),当然搜了一圈,很多博客或论坛上的答复基本都是ps看是否启动ssh服务,然后重启。本人ssh登录公司服务器一点问题没有,登录localhost居然报错,于是怀疑子openssh安装可能出现问题,可能是openssh-server或者openssh-client,于是一股脑全部重装试试:
sudo apt-get install openssh-client openssh-server Reading package lists... Done Building dependency tree
Reading state information... Done openssh-client is already the newest version. Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:
The following packages have unmet dependencies:
openssh-server : Depends: openssh-client (= 1:6.6p1-2ubuntu1) E: Unable to correct problems, you have held broken packages.
& & & &说openssh-server依赖于openssh-client,这是神马情况??于是:
sudo apt-get install openssh-client
Reading package lists... Done Building dependency tree
Reading state information... Done openssh-client is already the newest version. The following packages were automatically installed and are no longer required:
libxcb-randr0 libxcb-render-util0 libxcb-xkb1 mysql-common-5.6 Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
& & & 于是怀疑可能是libxcb-randr0、libxcb-render-util0、 libxcb-xkb1、 mysql-common-5.6这几个东东在作怪,于是:
sudo apt-get clean ?
sudo apt-get autoremove ?
sudo apt-get update Hit http://www.rabbitmq.com testing InRelease
Ign http://us.archive.ubuntu.com trusty InRelease
Ign http://get.docker.io docker InRelease
Ign http://ppa.launchpad.net trusty InRelease
Ign http://extras.ubuntu.com trusty InRelease
Hit http://us.archive.ubuntu.com trusty Release.gpg
Hit http://extras.ubuntu.com trusty Release.gpg
Ign http://ppa.launchpad.net trusty InRelease
Hit http://www.rabbitmq.com testing/main amd64 Packages
Hit http://us.archive.ubuntu.com trusty Release
Hit http://extras.ubuntu.com trusty Release
Ign http://ppa.launchpad.net trusty Release.gpg
sudo apt-get -f install Reading package lists... Done Building dependency tree
Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
& & & 再次重装openssh-server:
sudo apt-get install -y openssh-server Reading package lists... Done Building dependency tree
Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:
The following packages have unmet dependencies:
openssh-server : Depends: openssh-client (= 1:6.6p1-2ubuntu1) E: Unable to correct problems, you have held broken packages.
& & & 还是木有解决,重装openssh-client:
sudo apt-get install --reinstall openssh-client Reading package lists... Done Building dependency tree
Reading state information... Done Reinstallation of openssh-client is not possible, it cannot be downloaded. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
& & & &于是继续在网上,看到一篇博客http://blog.csdn.net/feliciafay/article/details/6561414,大概意思是openssh-server依赖openssh-client,然后openssh-client依赖openssh-server,如此循环,博主最终把问题解决了,但我个人不能接受如此复杂的解决办法。于是找了另一篇博客http://www.cnblogs.com/xiaowenhu/p/3185631.html,即在安装openssh-client时候指定其版本,于是得到了启发,再次尝试:
sudo apt-get install openssh-client=1:6.6p1-2ubuntu1
Reading package lists... Done Building dependency tree
Reading state information... Done Suggested packages:
libpam-ssh keychain monkeysphere The following packages will be DOWNGRADED:
openssh-client 0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded. Need to get 566 kB of archives. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main openssh-client amd64 1:6.6p1-2ubuntu1 [566 kB] Fetched 566 kB in 19s (28.8 kB/s)
dpkg: warning: downgrading openssh-client from 1:6.6p1-2ubuntu2 to 1:6.6p1-2ubuntu1 (Reading database ... 195887 files and directories currently installed.) Preparing to unpack .../openssh-client_1%3a6.6p1-2ubuntu1_amd64.deb ... Unpacking openssh-client (1:6.6p1-2ubuntu1) over (1:6.6p1-2ubuntu2) ... Processing triggers for man-db (2.6.7.1-1) ... Setting up openssh-client (1:6.6p1-2ubuntu1) ...
& & & & openssh-client安装正确,至少版本正确,再次安装openssh-server:
sudo apt-get install openssh-server
Reading package lists... Done Building dependency tree
Reading state information... Done The following extra packages will be installed:
libck-connector0 ncurses-term openssh-sftp-server ssh-import-id Suggested packages:
rssh molly-guard monkeysphere The following NEW packages will be installed:
libck-connector0 ncurses-term openssh-server openssh-sftp-server
ssh-import-id 0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded. Need to get 616 kB of archives. After this operation, 3,420 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main libck-connector0 amd64 0.4.5-3.1ubuntu2 [10.5 kB] Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main ncurses-term all 5.9+ubuntu1 [243 kB] Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty/main openssh-sftp-server amd64 1:6.6p1-2ubuntu1 [34.1 kB] Get:4 http://us.archive.ubuntu.com/ubuntu/ trusty/main openssh-server amd64 1:6.6p1-2ubuntu1 [319 kB] Get:5 http://us.archive.ubuntu.com/ubuntu/ trusty/main ssh-import-id all 3.21-0ubuntu1 [9,624 B] Fetched 616 kB in 10s (61.1 kB/s)
Preconfiguring packages ... Selecting previously unselected package libck-connector0:amd64. (Reading database ... 195887 files and directories currently installed.) Preparing to unpack ...bck-connector0_0.4.5-3.1ubuntu2_amd64.deb ... Unpacking libck-connector0:amd64 (0.4.5-3.1ubuntu2) ... Selecting previously unselected package ncurses-term. Preparing to unpack .../ncurses-term_5.9+ubuntu1_all.deb ... Unpacking ncurses-term (5.9+ubuntu1) ... Selecting previously unselected package openssh-sftp-server. Preparing to unpack .../openssh-sftp-server_1%3a6.6p1-2ubuntu1_amd64.deb ... Unpacking openssh-sftp-server (1:6.6p1-2ubuntu1) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a6.6p1-2ubuntu1_amd64.deb ... Unpacking openssh-server (1:6.6p1-2ubuntu1) ... Selecting previously unselected package ssh-import-id. Preparing to unpack .../ssh-import-id_3.21-0ubuntu1_all.deb ... Unpacking ssh-import-id (3.21-0ubuntu1) ... Processing triggers for man-db (2.6.7.1-1) ... Processing triggers for ureadahead (0.100.0-16) ... ureadahead will be reprofiled on next reboot Processing triggers for ufw (0.34~rc-0ubuntu2) ... Setting up libck-connector0:amd64 (0.4.5-3.1ubuntu2) ... Setting up ncurses-term (5.9+ubuntu1) ... Setting up openssh-sftp-server (1:6.6p1-2ubuntu1) ... Setting up openssh-server (1:6.6p1-2ubuntu1) ... Creating SSH2 RSA this may take some time ... Creating SSH2 DSA this may take some time ... Creating SSH2 ECDSA this may take some time ... Creating SSH2 ED25519 this may take some time ... ssh start/running, process 10352 Setting up ssh-import-id (3.21-0ubuntu1) ... Processing triggers for libc-bin (2.19-0ubuntu6.3) ... Processing triggers for ureadahead (0.100.0-16) ... Processing triggers for ufw (0.34~rc-0ubuntu2) ...
& & & 不再报之前的错!好像可以了诶~~
& & & 再次$ ssh localhost:
ssh localhost The authenticity of host 'localhost (127.0.0.1)' can't be established. ECDSA key fingerprint is 04:93:aa:b3:9c:32:bd:96:4f:c1:bf:78:19:f8:5b:e6. Are you sure you want to continue connecting (yes)? yes Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts. Welcome to Ubuntu 14.04.1 LTS (GNU/ 3.13.0-36-generic x86_64)
* Documentation:
https://help.ubuntu.com/
The programs included with the Ubuntu syst the exact distribution terms for each program are described in the individual files in /usr/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
& & & 成!功!了~
& & & &总结,其实仔细分析错误原因,直观点分析其原因就对了,而且个人感觉openssh不太好用,需要自己安装或者更新,容易走弯路。不过问题解决了是最重要的,希望各位同学不再因此走弯路咯~~
版权声明:本文为博主原创文章,未经博主允许不得转载。
来源:http://blog.csdn.net/bluecom24/article/details/搜索结果部分由o语言ssh简单的使用
&& 来源:open-open
package main
&go-ssh/ssh&
func main() {
SSH(&user&, &password&, &ip_port&)
func SSH(user, password, ip_port string) {
PassWd := []ssh.AuthMethod{ssh.Password(password)}
Conf := ssh.ClientConfig{User: user, Auth: PassWd}
Client, _ := ssh.Dial(&tcp&, ip_port, &Conf)
defer Client.Close()
a := bufio.NewReader(os.Stdin)
b, _, z := a.ReadLine()
if z != nil {
command := string(b)
if session, err := Client.NewSession(); err == nil {
defer session.Close()
session.Stdout = os.Stdout
session.Stderr = os.Stderr
session.Run(command)
版权申明:本站文章部分自网络,如有侵权,请联系028-0 邮箱:
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
400-028-5800SSH架构遇到Http struts500问题,一直解决不了!!!!!!
[问题点数:40分,结帖人DingXueBin001]
本版专家分:0
结帖率 66.67%
CSDN今日推荐
本版专家分:86721
2013年 总版技术专家分年内排行榜第六
2013年3月 总版技术专家分月排行榜第二
2014年2月 Java大版内专家分月排行榜第一2013年8月 Java大版内专家分月排行榜第一2013年5月 Java大版内专家分月排行榜第一2013年4月 Java大版内专家分月排行榜第一2013年3月 Java大版内专家分月排行榜第一2013年2月 Java大版内专家分月排行榜第一
2016年9月 Java大版内专家分月排行榜第二2013年9月 Java大版内专家分月排行榜第二2013年7月 Java大版内专家分月排行榜第二2013年6月 Java大版内专家分月排行榜第二2012年12月 Java大版内专家分月排行榜第二2012年10月 Java大版内专家分月排行榜第二
本版专家分:0
本版专家分:5136
本版专家分:525
本版专家分:3083
本版专家分:0
本版专家分:3083
本版专家分:0
本版专家分:3083
本版专家分:0
本版专家分:2424
本版专家分:2424
本版专家分:3083
本版专家分:3083
本版专家分:0
本版专家分:3083
本版专家分:0
本版专家分:3083
本版专家分:0
本版专家分:0
匿名用户不能发表回复!|
其他相关推荐}

我要回帖

更多关于 怎么做登录成功后跳转到指定的页面 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信