环境
wsl + windows10+ubunbu20.04
配置
安装sshd
$ sudo apt install openssh-server
配置sshd
$ sudo vi /etc/ssh/sshd_config
- 将以下选项注释打开
Port 22
AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::
- 将no修改为yes
PasswordAuthentication yes
启动sshd
$ sudo service ssh start
$ ps aux | grep sshd
root 962 0.0 0.0 20224 1084 ? Ss 21:00 0:00 sshd: /usr/sbin
使用SecureCRT连接wsl
- 获取主机IP地址
$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.10.1 netmask 255.255.255.0 broadcast 192.168.10.255
inet6 fe80::104e:3849:d94d:65f2 prefixlen 64 scopeid 0x0<global>
ether 00:50:56:c0:00:01 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
...
没有ifconfig命令, 通过如下命令安装
$ sudo apt install net-tools
- 使用SecureCRT连接会话
- 输入用户名和密码
- 成功登陆
弄了半天,发现可以直接通过wsl命令进入wsl系统,还是记录下,当时一种学习。
win+R -> cmd