简体   繁体   中英

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?

what should I do exactly ?

thanks

You can generate a public/private rsa key pair and save it on your server. Thus no password is required anymore.

If you are using 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)

$ ssh-keygen -t rsa -b 4096

Scp the key on your server:

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

$ 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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