Mar*_*rri 68
假设您在 Unix/Linux 环境中,您可以创建或编辑文件~/.ssh/config.
该配置文件允许您建立用于每个主机的参数;所以,例如:
Host host1
HostName <hostname_or_ip>
IdentityFile ~/.ssh/identity_file1
Host Host2
HostName <hostname_or_ip2>
User differentusername
IdentityFile ~/.ssh/identity_file2
Run Code Online (Sandbox Code Playgroud)
请注意,host1 和 host2 也可以不是主机名,而是用于标识服务器的标签。
现在您可以使用以下命令登录到主机:
ssh host1
ssh host2
Run Code Online (Sandbox Code Playgroud)