SFTP/SCP command re-prompts for passphrase

0

1

I'm logged into remote unix server and want to transfer file to sFTP. Issue is that entered passphrase is not accepted and constantly re-prompted.

This is my setting of folder and RSA file permissions

.ssh directory permissions: drwx------ 2 USER USER  131 Aug 29 11:17 .ssh
.ssh files permission: -rw------- 1 USER USER 1.5K Aug 29 11:17 user_priv.ppk

Code is executed from different folder on the same machine

scp -i /home/user/.ssh/user_priv.ppk file.csv 
sftp_user@xx.xx.xxx.xx:~/folder/folder

Once entered passphrase I get a notification:

'Enter passphrase for Key /home/user/.ssh/user_priv.ppk'

marcin2x4

Posted 2019-08-29T12:27:55.733

Reputation: 103

Answers

1

...user_priv.ppk ".ppk" is the extension used by the PuTTY key generator. I presume you used PuTTY's key generator to create the key.

The OpenSSH utilities (ssh, scp, and sftp) don't read the PuTTY key file format. If you want to use that key, then use the PuTTY key tool to export the key file in a format which ssh can use.

Alternately, use the OpenSSH key generation tool ssh-keygen to generate a new key and use that.

Note that the OpenSSH key file format actually uses two files. One file will have a name without an extension (like "id_rsa"), containing the private key. The other file will have a .pub extension (like "id_rsa.pub") and contains the public key. The contents of the .pub file have to be stored on the server that you want to connect to. You will normally add the contents of the .pub file to the .ssh/authorized_keys file on the server.

Kenster

Posted 2019-08-29T12:27:55.733

Reputation: 5 474

Once I get my password reset I will load and test my 'Export openSSh key' which I made in PuTTY :) – marcin2x4 – 2019-08-29T13:00:36.737

First thing I did was generate public+private pair of keys and sending public to sFTP. Can I convert private ppk to OpenSSH and use it in my script? Will that work with current public key? – marcin2x4 – 2019-08-29T13:14:21.453

Yes. Like I said in my answer, you can use the putty tool (putty-keygen) to export the putty key in an OpenSSH format. – Kenster – 2019-08-29T13:40:34.083