错误原因:
1.sshd 未安装
2.sshd 未启动

3.防火墙

4需重新启动ssh 服务

解决方法:
1.确定安装sshd:

$ sudo apt-get install openssh-server  

2.启动sshd:

$ sudo net start sshd  

3.检查防火墙设置,关闭防火墙:

$ sudo ufw disable   

检验方法:
输入命令:

$ ssh localhost  

若成功,则表示安装成功,且连接通过;

但是有的时候虽然成功了但是还是会出现Connection refused 问题。

运行 ps -e | grep ssh,查看是否有sshd进程:

有时候虽然可以看到sshd 但是还是不能连接成功

这时候就要想到重新启动一下:sudo service ssh restart

然后在连接

转自: http://www.xuebuyuan.com/733655.html

ssh: connect to host localhost port 22: Connection refused 问题的更多相关文章

  1. 运行Hadoop start-all.sh遇到的错误ssh: connect to host localhost port 22: Connection refused

    ssh: connect to host localhost port 22: Connection refused 我的情况是ssh server没装,查看方法: ps -e |grep ssh 1 ...

  2. ssh: connect to host localhost port 22: Connection refused

    1.hadoop安装好之后,执行ssh localhost无法执行, 提示“ssh: connect to host localhost port 22: Connection refused”. 2 ...

  3. 新手git: ssh: connect to host localhost port 22: Connection refused

    由于gitlab上要git pull或者git clone,可是每次都出现这个问题.之前偶尔出现这个问题.可是仅仅是偶尔.这是为什么呢?然后就開始搜索网上的解决方式了. 这个问题搜索网上非常多答案.可 ...

  4. ssh本机失败(ssh: connect to host localhost port 22: Connection refused)

    ssh本机失败(ssh: connect to host localhost port 22: Connection refused) 一. 问题描述 之前一直在服务上使用宝塔面板, 今天突发奇想, ...

  5. Ubuntu下 ssh : connect to host localhost port 22:Connection refused

    Ubuntu下测试ssh时使用ssh localhost 命令,出现错误提示connect to host localhost port 22:Connection refused 造成这个错误的原因 ...

  6. 使用ssh localhost命令,发生异常ssh: connect to host localhost port 22: Connection refused

    使用"ssh localhost"命令,失败: 问题分析如下: 出现这个问题是因为Ubuntu默认没有安装openssh-server.检查是否安装了openssh-server, ...

  7. 解决osx下 ssh: connect to host localhost port 22: Connection refused

    解决办法: 终端下执行:sudo  systmesetup -setremotelogin on

  8. mac connect to host localhost port 22: Connection refused

    在Mac OS X 10.10.5学习hadoop的过程中,输入命令ssh localhost得到 ssh: connect to host localhost port : Connection r ...

  9. ssh: connect to host master port 22: Connection refused

    hadoop集群启动的时候namenode显示Connection refused 到windows下ping  master 显示传输中过期 ip是静态的 ssh master 也是连接拒绝 重启s ...

随机推荐

  1. Xdebug开源PHP程序调试器

    Xdebug是一个开放源代码的PHP程序调试器(即一个Debug工具),可以用来跟踪,调试和分析PHP程序的运行状况. 本文为大家讲解的是在linux下xdebug的安装和配置方法,感兴趣的同学参考下 ...

  2. 使用github托管代码心

    这次使用github托管代码并没有下载客户端git for windows,而是使用eclipse里面自带的git上传了hello world这个项目,步骤如下: 1.首先创建项目:file-> ...

  3. vijos p1523 贪吃的九头龙 思考思考再思考,就荒废了4小时

    树形DP要有自己的风格,转二叉树是基础,考虑边界最头疼. #include<cstdio> #include<cstring> #include<algorithm> ...

  4. SQL注入备忘单

    Find and exploit SQL Injections with free Netsparker SQL Injection Scanner SQL Injection Cheat Sheet ...

  5. zoj3882 博弈

    我理解错题目意思,稀里糊涂A了.其实就是先手必胜. #include<stdio.h> int main() { int n; while(scanf("%d",&am ...

  6. array,vertor,arraylist,hashable,hashmap等几个易混淆概念的区别

    Array可以存放Object和基本数据类型,但创建时必须指定数组的大小,并不能再改变, Vertor是放的Object. Vertor一维,Hashmap/Hashtabe二维: Vertor/Ar ...

  7. 【POJ 3176】Cow Bowling

    题 Description The cows don't use actual bowling balls when they go bowling. They each take a number ...

  8. BZOJ-1705 Longge的问题 一维GCD SUM 乱搞+质因数分解+...

    2705: [SDOI2012]Longge的问题 Time Limit: 3 Sec Memory Limit: 128 MB Submit: 1871 Solved: 1172 [Submit][ ...

  9. USACO 3.2 butter 最短路

    堆优化dijkstra /* PROB:butter LANG:C++ */ #include <iostream> #include <cstdio> #include &l ...

  10. POJ2823 Sliding Window

    Time Limit: 12000MS   Memory Limit: 65536K Total Submissions: 53086   Accepted: 15227 Case Time Limi ...