Linux配置SSH名称通信

A主机  源端

1、执行ssh-keygen -t rsa    //生成密钥对

2、ssh-copy-id -i /root/id_rsa_host4.pub root@38.47.106.144 //将公钥传输给B主机

3、 在本机创建 SSH 别名(~/.ssh/config

把下面内容追加到 /root/.ssh/config(若不存在则新建):

 
cat >> /root/.ssh/config <<'EOF' Host host4 HostName 38.47.106.144 User root IdentityFile /root/id_rsa_host4 IdentitiesOnly yes EOF chmod 600 /root/.ssh/config

 

posted @ 2025-10-15 16:27  一只竹节虫  阅读(1)  评论(0)    收藏  举报