SSH登录服务器设置别名

一、通过ssh登录服务器

1
2
3
4
# 通过ip登录
ssh root@94.191.****
# 设置过别名通过别名登录
ssh root@test-1

二、设置别名登录

打开配置文件

1
2
# 打开配置文件
vi ~/.ssh/config

加入配置内容

1
2
3
4
5
6
7
8
9
10
11
12
# 当前文件 ~/.ssh/config 
# 第一台服务器
Host test1
HostName 94.191.***
Port 22
User root

# 华为服务器
Host test1
HostName 121.36.***
Port 22
User root