我正在尝试连接到需要私钥的远程主机,如何让jmeter使用此私钥才能连接?
我该怎么办?
感谢
答案 0 :(得分:3)
您可以生成公共/私有rsa密钥对并将其保存在服务器上。因此不再需要密码。
如果您使用的是Linux:
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
这将如下所示:(只需将密码留空)
$ Generating public/private rsa key pair.
$ Enter file in which to save the key (/home/<xxx>/.ssh/id_rsa):
$ Enter passphrase (empty for no passphrase):
$ Enter same passphrase again:
$ Your identification has been saved in /home/<xxx>/.ssh/id_rsa.
$ Your public key has been saved in /home/<xxx>/.ssh/id_rsa.pub.
现在您需要生成一个密钥:(生成4096位密钥)
$ ssh-keygen -t rsa -b 4096
Scp
服务器上的密钥:
$ scp /home/<xxx>/.ssh/id_rsa.pub <user>@<server_ip> <location_of_your_ssh_key_files>
Ssh
到您的服务器并将密钥添加到您的身份验证密钥,先备份它们:
$ cd <location_of_your_ssh_authkey_file>
$ cp authorized_keys authorized_keys_backup
$ cat id_rsa.pub >> authorized_keys
通常的位置是:
/home/<user>/.ssh/id_rsa