[WSL][ubuntu][原创]windows上ssh WSL的linux子系统
Posted FL1623863129
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[WSL][ubuntu][原创]windows上ssh WSL的linux子系统相关的知识,希望对你有一定的参考价值。
登录后安装
sudo apt install openssh-client openssh-server
修改配置:sudo vi /etc/ssh/ssh_config
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
Port 22
ListenAddress 0.0.0.0
PermitRootLogin no
PasswordAuthentication yes
# Protocol 2
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
重启ssh服务:
sudo service ssh restart
查看自己的ip地址:
ifconfig
fut@DESKTOP-19QNH4E:~$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.21.7.62 netmask 255.255.240.0 broadcast 172.21.15.255
inet6 fe80::215:5dff:fef7:b154 prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:f7:b1:54 txqueuelen 1000 (Ethernet)
RX packets 48378 bytes 72720775 (72.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9399 bytes 875394 (875.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 32 bytes 4926 (4.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32 bytes 4926 (4.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
登录:
ssh fut@172.21.7.62
注意端口22需要加入入站规则
配置Windows防火墙
打开windows Definder的高级设置:
- 点击左侧“入站规则”
- 点击右侧“新建规则”
- 选择“端口”
- 选择"TCP"
- 选择“特定本地端口”,并设定值为2222(与之前配置端口映射时的本机端口一致即可)
以上是关于[WSL][ubuntu][原创]windows上ssh WSL的linux子系统的主要内容,如果未能解决你的问题,请参考以下文章
游戏开发实战手把手教你在Windows上通过WSL运行Skynet,不用安装虚拟机,方便快捷(WSL | Linux | Ubuntu | Skynet | VSCode)
游戏开发实战手把手教你在Windows上通过WSL运行Skynet,不用安装虚拟机,方便快捷(WSL | Linux | Ubuntu | Skynet | VSCode)
Windows学习总结(23)——在 Windows 10 子系统 ubuntu 上利用 WSL2 安装 docker 的 2 种方式
Windows学习总结(23)——在 Windows 10 子系统 ubuntu 上利用 WSL2 安装 docker 的 2 种方式