编辑~/.ssh/config
文件,来创建别名(如果文件不存在,创建一个就行了)
vim ~/.ssh/config
添加所有远程主机的详细信息,如:
host dns
hostname server.example.com
user root
host dhcp
hostname 192.168.5.25
user ostechnix
port 22
host ubuntu
hostname 192.168.5.50
user senthil
identityfile ~/.ssh/id_rsa_remotesystem
保存退出之后,你就可以使用下列命令SSH连接远程主机
ssh dns
ssh dhcp
ssh ubuntu
请注意,这只使用于当前用户。如果要为当前系统的所有用户提供别名,请在 /etc/ssh/ssh_config
文件中添加以上行。