网上找了半天,都不够简单明了,我自己总结以下:
把你的本地主机用户的ssh公匙文件写入到远程主机用户的~/.ssh/authorized_keys文件中,具体方法
假设本地主机test1,远程主机test2
把你的Linux本地主机用户的ssh公匙文件写入到远程主机用户的~/.ssh/authorized_keys文件中,具体方法
一,在test1主机里的用户
运行 ssh-keygen -t rsa
结果如下
Generating public/private rsa key pair.
假设本地主机localhost,远程主机remote
Enter file in which to save the key (/home/.username/ssh/id_rsa):#回车
一,在localhost主机里的用户
Enter passphrase (empty for no passphrase):#回车
运行ssh-keygen -t rsa
Enter same passphrase again:#回车
结果如下
Your identification has been saved in /home/.username /.ssh/id_vnsc5858威尼斯城官网,rsa.
Generating public/private rsa key pair.
Your public key has been saved in /home/.username /.ssh/id_rsa.pub.
Enter file in which to save the key (/home/.username/ssh/id_rsa):#回车
The key fingerprint is:
Enter passphrase (empty for no passphrase):#回车
38:25:c1:4d:5d:d3:89:bb:46:67:bf:52:af:c3:17:0c username@localhost
Enter same passphrase again:#回车
Generating RSA keys:
Your identification has been saved in /home/.username /.ssh/id_rsa.
Key generation complete.
会在用户目录~/.ssh/产生两个文件,id_rsa,id_rsa.pub
Your public key has been saved in /home/.username /.ssh/id_rsa.pub.
二,把id_rsa.pub文件拷贝到test2主机的用户目录下
cat id_rsa.pub >~/.ssh/authorized_keys
就可以了
The key fingerprint is:
这样test1主机的用户就可以通过ssh而不用密码登陆test2主机
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
编辑:计算机教程 本文来源:在Linux下使用远程拷贝命令scp时去掉密码提示的方
关键词: