微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

优雅食用WSL

目录

优雅食用WSL

效果展示

image

前置条件

windows10且版本支持WSL

相关软件安装

  1. WSL

在“启用或关闭Windows功能”中 勾选“适用于Linux的Windows子系统”选项,并确认(该操作需要重新启动Windows系统)

  1. Ubuntu termius

在Windows Microsoft Store中搜索并安装“termius”和“Ubuntu”

配置WSL SSH服务

  1. 打开linux虚拟机并等待安装成功

  2. 安装ssh服务

sudo apt-get install openssh-server
  1. 修改配置文件

编辑文件/etc/ssh/sshd_config添加如下内容

# 端口配置
Port 6666 
UsePrivilegeSeparation no 
# 密码验证 
PasswordAuthentication yes 
# 允许登陆的用户 
AllowUsers name
  1. 开启并验证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

此时可以看到已经成功配置

参考文章地址

Xshell连接WSL

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐