优雅食用WSL
优雅食用WSL
效果展示
前置条件
windows10且版本支持WSL
相关软件安装
- WSL
在“启用或关闭Windows功能”中 勾选“适用于Linux的Windows子系统”选项,并确认(该操作需要重新启动Windows系统)
- Ubuntu termius
在Windows Microsoft Store中搜索并安装“termius”和“Ubuntu”
配置WSL SSH服务
-
打开linux虚拟机并等待安装成功
-
安装ssh服务
sudo apt-get install openssh-server
- 修改配置文件
编辑文件/etc/ssh/sshd_config并添加如下内容
# 端口配置
Port 6666
UsePrivilegeSeparation no
# 密码验证
PasswordAuthentication yes
# 允许登陆的用户
AllowUsers name
- 开启并验证SSH服务
# 开启服务
sudo service ssh --full-restart
# 验证服务
ps -e | grep sshd
配置termius SSH
创建新的SSH连接并配置host和port为127.0.0.1:6666,并验证是否可以通过SSH正常连接WSL
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Sat May 15 19:55:50 CST 2021
System load: 0.52 Processes: 9
Usage of /home: unknown Users logged in: 0
Memory usage: 64% IPv4 address for wifi0: 192.168.31.63
Swap usage: 0%
26 updates can be installed immediately.
26 of these updates are security updates.
To see these additional updates run: apt list --upgradable
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
chiale@LAPTOP-0JIALP82:~$ ls
此时可以看到已经成功配置