ssh配置文件有2处:

  • /etc/ssh/ssh_config
  • ~/.ssh/config

第二处是针对用户级别的,这里编辑的就是它.

示例:

Host host00    HostName 12.122.62.77    Port 8088    User smith#近程服务器别名    Host host01        #近程服务器地址    HostName www.gggg.com    #近程端口    Port 6061    #近程登录用户名    User git-ted    #私钥,必须是绝对路径    IdentityFile ~/.ssh/id_rsa

保留.
应用 ssh host00 便能够连贯到域名为 12.122.62.77 的服务器. ssh host01 能够连贯到 www.gggg.com 的服务器.

若想应用 scp,能够这样: scp ./file host00:~/xxx