linux ssh別名登錄的方法是什么

為了方便登錄服務器,我們一般使用putty、securecrt等等工具。在終端如何通過服務器別名來進行登錄呢?

可以創建~/.ssh/config 文件并為每臺服務器指定登錄信息和驗證方法,如下所示:

$?vim?~/.ssh/config  host?www ??hostname?www.ttlsa.com ??port?22 ??user?root ??identityfile?~/.ssh/id_rsa.pub ??identitiesonly?yes  host?bbs ??hostname?115.28.45.104 ??user?anotheruser ??pubkeyauthentication?no

然后直接指定別名進行登錄

shell
$ ssh www
1 $ ssh www
選項注釋:

hostname 指定登錄的主機名或ip地址
port 指定登錄的端口號
user 登錄用戶名
identityfile 登錄的公鑰文件
identitiesonly 只接受ssh key 登錄
pubkeyauthentication

? 版權聲明
THE END
喜歡就支持一下吧
點贊12 分享