I have to drop file in SFTP location and SFTP has ppk file instead password. I tried SSH SFTP with SSH key file locating to ppk file. But i am getting invalid primary key. Can you please help
SSH SFTP Sampler expects Putty Private Key, if you try to use OpenSSH id_rsa private key - you will get something like Failed to connect to server: invalid privatekey: [B#somehexvalues] error
If your private key starts with -----BEGIN OPENSSH PRIVATE KEY----- - you won't be able to use it with SSH SFTP sampler
If your private key starts with PuTTY-User-Key-File-2: ssh-rsa - you will be able to use it (assuming the server has the corresponding public key)
If you need to convert OpenSSH or RSA private key to Putty PPK - use PyttyGen application.
More information: Load Testing FTP and SFTP Servers Using JMeter
Related
I need to download a file from a remote server to my local. The SSH is running on a non-standard port and the remote server required a private key to connect to it from local.
I know how to achieve it separately:
For non standard port it is:
scp -P 2222 username#example.com:/backup/file.zip /local/dir
For server using private key it is:
scp -i private_key.pem username#example.com:/backup/file.zip /local/dir
But how can I download a file that require connecting to a non-default port as well as uses pem file (private key file)?
Any help would be appreciated.
Thanks
scp -i private_key.pem -P 2222 username#ip_address:/backup/file.zip .
This worked for me.
How to replace key-pair used to access AWS EC2 machines.
We have 3 machines (machineA, machineB, machineC) all using the same key-pair for SSH access. How can we replace this to a new key-pair
Here are the steps to use new key-pair to access ec2 machine:
Generate public-private key pair from within your instance. Sample command if using amazon linux2 to generate keypair:
ssh-keygen -t rsa
Append the newly generated public key to .ssh/authorized_keys file
cat newkeypair.pub >> .ssh/authorized_keys
Now you will need to download the private key part. One way would be to give AmazonS3FullAccess role to ec2instance and upload the private key part to a bucket as below
aws s3 cp newkeypair s3://my-bucket
After downloading the private key part to your local machine, change its permission and connect with your ec2-instance
chmod 400 newkeypair
ssh -i newkeypair ec2-user#instance-public-ip
I am quite new to nornir and network automation but I am in stuck with following scenario.
ssh via using ssh key. Using access via password works without problem.
My hosts.yaml look like this
---
juniper-tst:
hostname: 10.0.0.12
port: 22
username: mario
platform: junos
But I keep getting this error
ncclient.transport.errors.AuthenticationError: SSHException('encountered RSA key, expected OPENSSH key',)
Now I am not sure if any extra optional argument is needed to be inserted in the hosts.yaml.
versions:
Python3.6
Nornir 3.1
This is related to the format of your private key. You should know that there are openssh format and PEM format. Both will work when connecting to openssh server but some libssh based applications may be picky (I had issue with zabbix ssh).
You are using the "PEM format" which starts with "-----BEGIN RSA PRIVATE KEY-----"
just generate an new set of keys with ssh-keygen which default to the OPENSSH format which starts with "-----BEGIN OPENSSH PRIVATE KEY-----"
I have my Git/Gerrit set up on my Ubuntu PC and the below worked fine. However, I am trying to do the same on my Windows PC, but it fails to clone the repository saying -
"Unable to negotiate with 55.115.127.145 port 9418: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
fatal: Could not read from remote repository."
Adding below in ~/.ssh/config: doesn't work too !
Host your_email#lab126.com
KexAlgorithms +diffie-hellman-group1-sha1
IdentityFile ~/.ssh/id_rsa
Host 55.115.127.145
HostName 55.115.127.145
User <myname>
Port 9418
KexAlgorithms +diffie-hellman-group1-sha1
IdentityFile ~/.ssh/id_rsa
Below are the detailed steps I followed:
1) Downloaded and installed Git from http://git-scm.com/downloads
2) Setup Your Git Username and Email
git config --global user.name "FirstName LastName"
git config --global user.email "your_email#lab126.com"
3) Set up RSA key
ssh-keygen -t rsa -C "your_email#lab126.com
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/username/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
4) Public Private keys saved in (/Users/username/.ssh/id_rsa) and (/Users/username/.ssh/id_rsa.pub) files
5) Set Up Gerrit :
Login to https://e-gerrit.lab.net/
6) In Gerrit, Select settings -> SSH Public Keys -> Add Key -> Copy & Paste Public Key
7) Open cmd line and clone the repository
C:\Git>git clone ssh://e-gerrit.lab.net:9418/framework -b test
8) Add config file in ~/.ssh/ as above
My task is automate uploading file to sftp server by using Jenkins CI.
My permissions is very limited and I have no access to sftp server via ssh.
I have tried to use sftp bash command but have a problem with automation input password (expect can not be installed)
Curl also have problems :
curl --insecure -vvv -T filename.xml -u user:password sftp://server.com:XXXX
* About to connect() to server.com port XXXX (#0)
* Trying xxx.xxx.xxx.xxx... connected
* Connected to server.com (xxx.xxx.xxx.xxx) port XXXX (#0)
* SSH authentication methods available: publickey,password
* Using ssh public key file /home1/user/.ssh/id_dsa.pub
* Using ssh private key file /home1/user/.ssh/id_dsa
* SSH public key authentication failed: Unable to open public key file
* Initialized password authentication
* Authentication complete
* Upload failed: Permission denied (3/-31)
Connection #0 to host server.com left intact
curl: (9) Upload failed: Permission denied (3/-31)
* Closing connection #0
Can you help me to find another way or resolve my problem?
Thank you.
'My permissions is very limited and I have no access to sftp server
via ssh.'
If you can't access the server via SSH, any SSH based authentication system isn't going to work. Your public key can't be opened, so check that it's the correct file path to the public key and that it's the right type of key. Should start with "-----BEGIN RSA PRIVATE KEY-----" and end with the same comment.