优雅食用WSL

2021/5/18 18:55:38

本文主要是介绍优雅食用WSL,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

目录
  • 优雅食用WSL
    • 效果展示
    • 前置条件
    • 相关软件安装
    • 配置WSL SSH服务
    • 配置termius SSH
    • 参考文章地址

优雅食用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



这篇关于优雅食用WSL的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程