您的位置:首页 > 运维架构 > Linux

win10下Linux子系统开启ssh服务

2018-09-17 13:57 706 查看
虽然win10自带的bash功能已经很丰富,操作也简便,不过习惯了用xshell, 还是选择用xshell来操作

直接用xshell连接127.0.0.1 端口22 提示连接失败。说明应该是ubuntu的sshd服务设置有问题:

解决方案如下:

安装ssh

apt-get install openssh-server


备份sshd配置文件

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak


修改内容:

Port 23 # 端口改为23,22端口已被占用
ListenAddress 0.0.0.0 # 取消注释
#StrictModes yes # 注释
PasswordAuthentication yes # 允许密码登录


启动ssh

service ssh start

如果提示
sshd error: could not load host key
,则用下面的命令重新生成

sudo rm /etc/ssh/ssh*key
dpkg-reconfigure openssh-server

大功告成

作者:章鱼喵_
链接:https://www.jianshu.com/p/36440b7df56a
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Bash Xshell Linux Ubuntu