×

windows10下linux子系统的使用

穆琪 穆琪 发表于2019-02-20 09:07:22 浏览474 评论0

抢沙发发表评论

启用的Linux子系统

启用开发者模式
系统模式的设定位于所有设置 - >更新和安全 - >针对开发人员

更改系统功能

使用win+X快捷键调出系统-管理菜单后点击程序与功能,选择启用或关闭的Windows功能,修改“适用于的Windows的Linux的子系统一项”

勾选之,确认并重启。

安装系统

打开win10的应用商店,搜索linux,在专题中选择一个下载就行,我选的ubuntu18 Lts

linux的SSH设置(可以使用putty登录)

安装ssh
sudo apt install openssh-server openssh-client

一般会提示已经安装或者升级了。

备份sshd配置文件
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
修改配置文件
sudo vim /etc/ssh/sshd_config

需要修改以下几项:

Port 22    #取消注释
ListenAddress 0.0.0.0    #取消注释
#PermitRootLogin prohibit-password    #注释
PermitRootLogin yes    #添加这行
#StrictModes yes # 注释
PasswordAuthentication yes # 允许密码登录

wq保存退出
重启sshd服务

sudo service ssh restart

如果提示sshd error: could not load host key,则用下面的命令重新生成:

sudo rm /etc/ssh/ssh*key
sudo dpkg-reconfigure openssh-server

注意:使用dpkg-reconfigure openssh-server时选择默认的那个keep项,选择OK。
接着重启sshd服务

sudo service ssh restart

现在使用putty之类的就可以登陆了。