当前位置: 移动技术网 > 网络运营>服务器>Linux > linux ssh 别名登录小技巧

linux ssh 别名登录小技巧

2019年04月30日  | 移动技术网网络运营  | 我要评论
为了方便登录服务器,我们一般使用putty、securecrt等等工具。在终端如何通过服务器别名来进行登录呢? 可以创建~/.ssh/config 文件并为每台服务器指定

为了方便登录服务器,我们一般使用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

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网