BUG

使用 sudo service ssh start 启动 ssh 服务,提示:

 * Restarting OpenBSD Secure Shell server sshd
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key
[ OK ]

然后使用 powershell 连接,提示 refused:

PS C:\Users\suyua> ssh ryan@localhost
ssh: connect to host localhost port 22: Connection refused

FIX

卸载重装 openssh-server:

sudo apt-get purge openssh-server  # purge 是卸载并删除配置文件
sudo apt-get install openssh-server

然后修改 /etc/ssh/sshd_config 的下列几行参数:

#Port 22   # 如果端口冲突,就需要修改这个
ListenAddress localhost # 只接受本地请求
PasswordAuthentication yes # 允许密码登录

重启 ssh 服务:

sudo service ssh restart

然后连接:

PS C:\Users\suyua> ssh ryan@localhost
ryan@localhost's password:
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.4.0-17763-Microsoft x86_64) * Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage ......

问题解决。

参考

最新文章

  1. html+css+js 模拟win7桌面
  2. Spring中servletFileUpload完成上传文件以及文本的处理
  3. Android数据存储五种方式总结
  4. MFC 打开链接的方法
  5. vim的编码设置
  6. linux终端-console
  7. Babelfish
  8. 武汉科技大学ACM :1003: 零起点学算法67——统计字母数字等个数
  9. asp.net session的原理
  10. C# 分析搜索引擎url 得到搜索关键字
  11. 编译安装gimp插件之Mathmap(流水记录)
  12. Java并发,看到了,就记录下呗
  13. 前端基于JQgrid实现自定义列头展示
  14. Mysql中的in和find_in_set的区别?
  15. Tomcat学习
  16. 想玩 Android 开发板?这些常用命令你不知不行!
  17. react图工具集成
  18. ORACLE 根据 sql_id 查询绑定变量的传入值
  19. delphi中 panel如何在Form实现鼠标移动拖放
  20. v-html对于↵转义的问题

热门文章

  1. scrapy 一些坑
  2. Jenkins定时任务的配置
  3. 【JDBC】仅输入表名和要插入的记录数,自动检测表的字段和类型,然后插入数据的全自动程序(Oracle版)
  4. MySQL 正则(Regular Expression) 邮箱(Email)
  5. SNAT场景模拟
  6. django实战总结2
  7. ISO/IEC 9899:2011 条款6.5.4——投射操作符
  8. 008-SpringBoot发布WAR启动报错:Error assembling WAR: webxml attribute is required
  9. Spring cloud微服务安全实战-4-11Zuul网关安全开发(四)
  10. 头文件里声明和定义,Qt编译不过问题