在使用 jmeter 时尝试使用 ssh 私钥

Trying to use ssh private key while using jmeter

我正在尝试连接到需要私钥的远程主机,如何让 jmeter 使用此私钥进行连接?

我应该怎么做?

谢谢

您可以生成一个 public/private rsa 密钥对并将其保存在您的服务器上。因此不再需要密码。

如果您正在使用 Linux:

$ mkdir ~/.ssh
$ chmod 700 ~/.ssh

现在您需要生成一个密钥:(制作一个 4096 位密钥)

$ ssh-keygen -t rsa -b 4096

这看起来像:(将密码留空)

$ 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.

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