Wanzul Blog

Notes, opinions, and lessons I paid for.

How to simplify access to SSH with .ssh/config

如何使用 .ssh/config 简化 SSH 访问

如果你经常需要 SSH,而且要查看服务器 IP 地址才能 SSH,这就是简化流程的方法。策略是给 SSH 地址设定一个名称,之后你只需输入 SSH + 名称就能连接。

在你的 ~/.ssh/config 文件中,设置以下内容:

Host yoursshname
Hostname yourserveripaddress
User ubuntu
IdentityFile ~/.ssh/id_ed25519
  1. 记得把 yoursshname 改成你喜欢的任何名称。
  2. 记得把 yourserveripaddress 改成你的服务器 IP 地址或服务器主机名。
  3. 记得把 ubuntu 改成你的服务器用户名。
  4. 记得正确设置 IdentityFile 的路径。
Wan Zulkarnain 的头像

Written by 

Comments

发表回复