Mic*_*ick 124 ssh bash windows-10 windows-subsystem-for-linux windows-10-v1607
我安装了 Windows 10 周年纪念版,并安装了“Windows 上的 Bash on Ubuntu”。我希望能够通过 SSH 连接到这个 Ubuntu 实例,但是尽管我已经安装和配置了 openssh-server(并在端口 2200 上侦听),但是当我尝试 ssh 到“localhost:2200”时,它告诉我“服务器意外关闭网络连接”。
有没有人能够成功地做到这一点?
Mas*_*zel 144
我让它工作了;就是这样。
卸载 ssh-server,重新安装它并确保它已启动
sudo service ssh --full-restart
Run Code Online (Sandbox Code Playgroud)
确保您关闭了 root 访问权限并在配置文件中添加了另一个用户。
我能够按预期连接到 127.0.0.1:22 上的子系统。我希望这能帮到您。
sudo apt-get purge openssh-server
sudo apt-get install openssh-server
sudo nano /etc/ssh/sshd_config
并通过设置禁止 root 登录 PermitRootLogin no
然后在它下面添加一行,上面写着:
AllowUsers yourusername
并确保PasswordAuthentication
设置为yes
是否要使用密码登录。
通过添加/修改禁用权限分离: UsePrivilegeSeparation no
sudo service ssh --full-restart
使用 PuTTY 等 ssh 客户端从 Windows 连接到您的 Linux 子系统。
NYC*_*yes 39
上面的答案很接近,但我仍然有Connection closed by 127.0.0.1
问题。
因此,从头开始并--purge
在删除sshd
包时提供选项(如下所示),解决了我对这个问题的变体:
user$ sudo apt-get remove --purge openssh-server # First remove sshd with --purge option.
user$ sudo apt-get install openssh-server
user$ sudo vi /etc/ssh/sshd_config # **See note below.
user$ sudo service ssh --full-restart
# ** Change Port from 22 to 2222. (Just in case MS-Windows is using port 22).
# Alternatively, you can disable MS-Windows' native SSH service if you
# wish to use port 22.
Run Code Online (Sandbox Code Playgroud)
我希望这有帮助。\(???)/
小智 27
Since windows implementation doesn't provide chroot you need to modify the /etc/ssh/sshd_config
UsePrivilegeSeparation no
Run Code Online (Sandbox Code Playgroud)
Also you will need to create a user using useradd command or so.
我按照 Azazel 大师的建议做了所有事情,但遇到了问题。当我连接到端口时,22
我被要求输入密码,但我在 Linux 子系统中设置的密码不起作用。
解决方案#1:
更改/etc/ssh/sshd_config
子系统中的SSH端口并重启SSH服务器
解决方案#2:
在Windows 的服务控制面板中禁用/停止“SSH 服务器代理服务”并重新启动子系统中的SSH 服务器。
归档时间: |
|
查看次数: |
216860 次 |
最近记录: |