Bash on Windows provides developers with a familiar Bash shell and Linux environment in which you can run most Linux command-line tools, directly on Windows, UNMODIFIED, without needing an entire Linux virtual machine!
Bash/WSL allows you to:
- Run common command-line utilities such as
grep
,sed
,awk
, etc. delivered by an- Use the Linux-compatible filesystem & heirarchy and access fixed Windows storage mounted under
/mnt/...
- Run Bash shell scripts and Linux command-line apps. including
- Tools: vim, emacs, tmux
- Languages: Javascript/node.js, Ruby, Python, C/C++, C# & F#, Rust, Go, etc.
- Services: sshd, MySQL, Apache, lighttpd,
- Install additional Linux tools using
apt
- Invoke Windows applications from within Bash
- Invoke Linux applications from within Windows!
Bash on Windows runs Ubuntu user-mode binaries provided by Canonical. This means the command-line utilities are the same as those that run within a native Ubuntu environment.
這不是虛擬機器VM,也不是容器Docker,也不是專為 Windows 編譯的 Linux binary,他就只是個Windows 10的子系統WSL,但我想他未來有很多的想像空間。
其實我懶得想那麼複雜,就把它當成一個小算盤程式一樣,只是他功能很多還可以在裡面跑一些東西。既然玩玩,就想那怎麼讓母系統Windows 10可以用Putty或SSH去連裡面的SSH Server呢?
1. sudo nano /etc/ssh/sshd_config
2. 要修改一些設定如:
UsePrivilegeSeparation no
PermitRootLogin no
AllowUsers yourusername
PasswordAuthentication yes
3. sudo service ssh – -full-restart
4. 關掉Windows 10 SSH Server Broker Services 服務,因為預設Windows 10本身也有SSH Server,否則不知要連哪一個,會發現一直連不進Bash/WSL。當然也可以直接改SSH Server 的 Port 號,只是我不太想改變習慣。
5. 使用Putty連本機或像我一樣打Bash內名稱,反正都一樣。
之後,就算不用執行Bash/WSL,一樣可以用Putty連進去。
其中SSH 設定的部分可以參考鳥哥11.2.5 sshd 伺服器細部設定
http://linux.vbird.org/linux_server/0310telnetssh.php