网上找了半天,都不够简单明了,我自己总结以下:
把你的本地主机用户的ssh公匙文件写入到远程主机用户的~/.ssh/authorized_keys文件中,具体方法
假设本地主机localhost,远程主机remote
一,在localhost主机里的用户
运行ssh-keygen -t rsa
结果如下
Generating public/private rsa key pair.
Enter file in which to save the key (/home/.username/ssh/id_rsa):#回车
Enter passphrase (empty for no passphrase):#回车
Enter same passphrase again:#回车
Your identification has been saved in /home/.username /.ssh/id_rsa.
Your public key has been saved in /home/.username /.ssh/id_rsa.pub.
The key fingerprint is:
38:25:c1:4d:5d:d3:89:bb:46:67:bf:52:af:c3:17:0c username@localhost
Generating RSA keys:
Key generation complete.
会在用户目录~/.ssh/产生两个文件,id_rsa,id_rsa.pub
步骤如下:
ssh-keygen -t rsa或ssh-keygen -d (dsa) =>产生出id_rsa, id_rsa.pub
scp id_rsa.pub server_h
scp 免密码传输
最新推荐文章于 2024-07-23 08:04:55 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)