使用SSH登入Winodws 10上Ubuntu Bash


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:

  1. Run common command-line utilities such as grep, sed, awk, etc. delivered by an
  2. Use the Linux-compatible filesystem & heirarchy and access fixed Windows storage mounted under /mnt/...
  3. 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,
  4. Install additional Linux tools using apt
  5. Invoke Windows applications from within Bash
  6. 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內名稱,反正都一樣。

a

之後,就算不用執行Bash/WSL,一樣可以用Putty連進去。

其中SSH 設定的部分可以參考鳥哥11.2.5 sshd 伺服器細部設定
http://linux.vbird.org/linux_server/0310telnetssh.php

Swift:No such module ‘Cocoa’


在一開始使用Playground來學習Swift語法時,   選擇了macOS平台, 但卻出現了下面訊息說找不到模組。

%e8%9e%a2%e5%b9%95%e5%bf%ab%e7%85%a7-2017-03-06-%e4%b8%8b%e5%8d%886-05-18

原因是雖然我們選擇了macOS平台, 但Xcode卻內定給我們設定了iOS, 所以要變更過來即可。選擇右上方的Inspeter, Playground Settings, 改成macOS。

%e8%9e%a2%e5%b9%95%e5%bf%ab%e7%85%a7-2017-03-06-%e4%b8%8b%e5%8d%886-12-52

%e8%9e%a2%e5%b9%95%e5%bf%ab%e7%85%a7-2017-03-06-%e4%b8%8b%e5%8d%886-13-18

天下布武


最近砍掉一些原圖已不見的文章,  打算要上一些新文章放進頁面去, 不再以流水文章方式發布了。因為從過去幾年來的好朋友來查文討論, 發現用頁面方式對訪友最方便。

放上這張頂尖職業得獎攝影師最初放上我網站的實驗照片(他的網站也是我代為草創的, 連結在照片上), 代表我也希望能邁向天下布武的初衷。