简体   繁体   English

尝试在使用Jmeter时使用SSH私钥

[英]Trying to use ssh private key while using jmeter

I am trying to connect to a remote host which require private key, how do I make jmeter to use this private key in order to connect? 我试图连接到需要私钥的远程主机,如何使jmeter使用此私钥进行连接?

what should I do exactly ? 我应该怎么做?

thanks 谢谢

You can generate a public/private rsa key pair and save it on your server. 您可以生成一个公共/私有rsa密钥对并将其保存在服务器上。 Thus no password is required anymore. 因此,不再需要密码。

If you are using Linux: 如果您使用的是Linux:

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

This will look like: (just leave the passphrase blank) 这看起来像:(只需将密码短语留空)

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

Now you need to generate a key: (makes a 4096 bit key) 现在您需要生成一个密钥:(创建一个4096位密钥)

$ ssh-keygen -t rsa -b 4096

Scp the key on your server: Scp服务器上的密钥:

$ scp /home/<xxx>/.ssh/id_rsa.pub <user>@<server_ip> <location_of_your_ssh_key_files>

Ssh to your server and add the key to your auth keys, backup them first: Ssh到您的服务器,并将密钥添加到您的身份验证密钥,首先备份它们:

$ cd <location_of_your_ssh_authkey_file>
$ cp authorized_keys authorized_keys_backup
$ cat id_rsa.pub >> authorized_keys

the usual location is: 通常的位置是:

/home/<user>/.ssh/id_rsa

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM