给主机起别名(SSH)

Give SSH hostname alias names.

当使用SSH登录远端的主机时,常常要输入长长的一串主机名,比如:xxx@wonderland.sph.umich.edu。
我发现了一个简便的方法:
在.ssh/config里面加入下面的字段:
Host won
Hotname wonderland.sph.umich.edu
这样只需要输入ssh won,就可以登录wonderland.sph.umich.edu主机了。
上面的方法可以使用ssh,sftp。

还有一个更简便的方法可以使用ssh,但不能兼顾sftp,就是用bash alias功能,比如:
alias won=’ssh xxx@wonderland.sph.umich.edu’
那么只需要输入won就可以登录了。

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.