整理一下上述的問題
- 帶domain name太攏長了(ex. ssh wawa@abc.com.tw -p 12345)
- ssh連線若沒有加入帳號是帶入本機的帳號,因此要在帶入帳號
- 不同主機ssh port可能不同,ssh又要多打一個參數
# cat ~/.ssh/config
Host abc #short name別名
HostName abc.com.tw #完整domain name
User wawa #帳號
Port 12345 #ssh listen port
Host def
HostName 192.168.1.80 #ip也可以
User csliu
Port 6789
設定完成之後就可以來測試看看連線囉!當然一定也會通的,主要來看看ssh到底少打了幾個字
ssh wawa@abc.com.tw -p 12345 #原本
變成
ssh abc #設定別名後
當然這樣的設定在scp也是可以被接受的囉!
scp -P 12345 somefile wawa@abc.com.tw:~ #原本
變成
scp somefile abc:~ #設定別名後
參考文章
http://plog.longwin.com.tw/my_note-unix/2009/04/16/ssh-create-shortcut-fast-connect-2009
之前寫的SSH Tunnel On Linux Over Http Proxy也有寫到~/.ssh/config這個設定檔唷!應該也可以再結合!
https://blog.easylife.tw/1215