SSH登录Windows的Linux子系统
Ricky
posted @ 2016年8月18日 23:27
in Other
, 3769 阅读
Windows 10带来了Ubuntu Linux子系统但是缺少好的终端支持直接登录,只有用ssh客户端曲线登录本机了
1.安装:cmd下执行lxrun /install
2.重新安装openssh-server: sudo apt-get remove openssh-server
sudo apt-get install openssh-server
apt-get的源可以修改为用国内的,比如163或者aliyun
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
安装过程会遇到很多错误,如果遇到Unable To Connect To Upstart,则执行:
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
遇到invoke-rc.d: policy-rc.d denied execution of start则修改/usr/sbin/policy-rc.d为exit 0
3.重启sshd sudo service ssh --full-restart
Windows 10自带了ssh服务可能会占用22端口,所以需要停用两个服务
另外遇到upstart的问题可以用如下命令
apt-get remove upstart
apt-get remove udev
apt-get autoremove
然后重新安装upstart
最后cmd下设置默认用户:lxrun /setdefaultuser root
4.设置ssh免密码登录:ssh-keygen -t rsa
由于都是同一host的一个用户 直接将id_rsa.pub重定向到authorized_keys即可
这样就 可以尽情在Windows下用 Linux开发 工具了