我正在尝试连接到需要私钥的远程主机,如何让 jmeter 使用此私钥进行连接?
我应该怎么做?
谢谢
最佳答案
您可以生成公钥/私钥 rsa key 对并将其保存在您的服务器上。因此不再需要密码。
如果您使用的是 Linux:
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
现在您需要生成一个 key :(制作一个 4096 位 key )
$ 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
服务器上的 key :
$ scp /home/<xxx>/.ssh/id_rsa.pub <user>@<server_ip> <location_of_your_ssh_key_files>
Ssh
到您的服务器并将 key 添加到您的身份验证 key ,首先备份它们:
$ cd <location_of_your_ssh_authkey_file>
$ cp authorized_keys authorized_keys_backup
$ cat id_rsa.pub >> authorized_keys
通常的位置是:
/home/<user>/.ssh/id_rsa
关于linux - 在使用 jmeter 时尝试使用 ssh 私钥,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44225211/