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

一. 问题描述

  之前一直在服务上使用宝塔面板, 今天突发奇想, 想要在本机使用宝塔面板. (宝塔面板真的好用, 尤其对我这个zz小白来说)... 可是装好宝塔面板后, 启动面板的终端的时候, 发现输入ssh用户名密码的时候,  没有反应, 密码账号明明是对的啊!!!

有人可能要问了, 你tm在本机上使用宝塔面板, 还要使用宝塔的终端,, 不是多此一举吗!?,,, emmm确实是, 不过我就是喜欢多此一举... 既然发现这个问题了, 就来试试怎么解决吧!

二.解决问题

  原因可能是: 端口没有打开, 本地防火墙拒绝, 本机没有ssh服务;

  最后发现问题是, 本机没有ssh服务, 对! 就是没有, 大家使用linux的时候ssh是经常使用的, 但是本机却可能是没有ssh服务的, 所以我们要安装ssh服务;

  1. 生成ssh秘钥

    $ ssh-keygen -t rsa (连按回车,生成秘钥)
    
    $ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  2. 安装openssh-server(以ubuntu操作系统为例)

    $ sudo apt install openssh-server
    
    $ sudo /etc/init.d/ssh start
  3. 测试

    $ ps -ef | grep ssh(查看sshd进程)
    
    $ ssh 127.0.0.1

三. 成功:

  如图:

有问题请留言,,, 看到会帮忙解决!!! 

ssh本机失败(ssh: connect to host localhost port 22: Connection refused)的更多相关文章

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

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

  2. 运行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 ...

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

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

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

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

  5. 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 ...

  6. ssh: connect to host localhost port 22: Connection refused 问题

    错误原因:1.sshd 未安装2.sshd 未启动 3.防火墙 4需重新启动ssh 服务 解决方法:1.确定安装sshd: $ sudo apt-get install openssh-server ...

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

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

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

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

  9. ubuntu安装配置ssh-connect to host localhost port 22: Connection refused

    在安装ssh,经常出现 ssh: connect to host localhost port 22: Connection refused 从以下几点去检查: 1.是否安装ssh-server: 打 ...

随机推荐

  1. 浏览器低延时播放监控摄像头RTSP海康大华硬盘录像机NVR视频(EasyNVR播放FLV视频流)

    背景描述 EasyNVR的使用者应该都是清楚的知道,EasyNVR一个强大的功能就是可以进行全平台的无插件直播.主要原因在于rtsp协议的视频流(默认是需要插件才可以播放的)经由EasyNVR处理后可 ...

  2. Swift编码总结4

    1.swift @discardableResult 声明: swift正常的方法如果有返回值的话,调用的时候必须有一个接收方,否则的话编译器会报一个警告,如果在方法前加上 @discardableR ...

  3. [LeetCode] 61. Rotate List 旋转链表

    Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: I ...

  4. [LeetCode] 219. Contains Duplicate II 包含重复元素 II

    Given an array of integers and an integer k, find out whether there are two distinct indices i and j ...

  5. nginx下只能通过域名,禁止使用ip访问

    今天来了一个需求,ip访问返回500,域名访问正常,只需在nginx.conf中添加 server { listen 80 default; #default 必须加的 return 500; } 也 ...

  6. idea设置内存大小

    1.打开idea安装路径下bin,编辑.vmoptions两个文件 然后重启一下idea 2.直接打开idea的.vmoptions文件进行编辑

  7. 【剑指offer】面试题 24. 反转链表

    面试题 24. 反转链表

  8. vue总结的知识点

    1.Vue生命周期钩子,都是干嘛用的? Vue实例从创建到销毁的过程,就是生命周期.Vue的生命周期包括:开始创建.初始化数据.编译模板.挂载Dom.渲染→更新→渲染.卸载等一系列过程.在Vue的整个 ...

  9. Spring Cloud Stream如何消费自己生产的消息

    在上一篇<Spring Cloud Stream如何处理消息重复消费>中,我们通过消费组的配置解决了多实例部署情况下消息重复消费这一入门时的常见问题.本文将继续说说在另外一个被经常问到的问 ...

  10. go 读取BMP文件头二进制读取

    BMP文件头定义: WORD 两个字节 16bit DWORD 四个字节 32bit package main import ( "encoding/binary" "f ...