apiv1

配置方法

~/.ssh/config

Host 服务器名A
    user 用户名
    hostname 服务器ip
    port 端口号
    identityfile 本地私钥地址
    ...
Host 服务器名B
    user 用户名
    hostname 服务器ip
    port 端口号
    identityfile 本地私钥地址
    ...
...
...
Host *
    ...
    ...

配置选项

配置例子

配置文件

mkdir -p ~/.ssh && echo "
Host *
    ServerAliveInterval  60
    ServerAliveCountMax  60
    ConnectTimeout 30
    StrictHostKeyChecking no
    UserKnownHostsFile=/dev/null
">> ~/.ssh/config
chmod 400 ~/.ssh/config

使用alias

alias ssh="ssh \
    -o ServerAliveInterval=60 \
    -o ServerAliveCountMax=60 \
    -o ConnectTimeout=30 \
    -o UserKnownHostsFile=/dev/null \
    -o StrictHostKeyChecking=no \
    "