0

I've done enough search on google and in this site, but I don't find any answer to my problem. I simply want to transfer file from local windows machine into remote ubuntu server.

This is the command I tried:

scp C:/Users/myself/Documents/personal/gd_bundle-g2-g1.crt bitnami@11.123.12.123:/etc/ssl/certs

I get this error:

Permission Denied (Publickey)

Obviously because I didnt key in the keyfile and I dont know where to key in. So please guide me how can I transfer file to remove server with public key specified.

Thanks

edit:

scp -i C:\Users\myself\Documents\personal\ppk\myfile.ppk bitnami@11.123.12.123:/C:/Users/myself/Documents/personal/gd_bundle-g2-g1.crt   /etc/ssl/certs

Getting error : wrong format

112233
  • 2,406
  • 3
  • 38
  • 88
  • 1
    Does this answer your question? you need to use `-i` option to give key file https://stackoverflow.com/questions/24116454/using-ssh-keys-with-scp-and-ssh/31474055#31474055 – Mahattam Jan 07 '20 at 02:26
  • yes something like this is what i's looking for. But it gives another error saying wrong format. could you check my edited post? – 112233 Jan 07 '20 at 02:34
  • You need to use `.pem` format with scp command, so convert your ppk to pem using puttygen if you using windows then use the same command to copy the files. – Mahattam Jan 07 '20 at 02:38
  • great! Tried. Its says no such file or directory for the local file path. I checked the path is correct – 112233 Jan 07 '20 at 02:40
  • I guess by looking at file path its windows path format and I believe you are using scp on command terminal using openssh, so first make sure you are using correct path try to debug by listing the file using `ls C:\Users\myself\Documents\personal\ppk\myfile.ppk` command and then correct the local path. – Mahattam Jan 07 '20 at 04:12
  • Use FTP or Windows File and Print sharing. –  Jan 07 '20 at 04:15

1 Answers1

-2

You need to create an ssh key pair, a public and private key. There are many sites that explain how to do it, usually you run ssh-keygen, such as specified here.

The private key is "id_rsa" and the public key is "id_rsa.pub". On the remote machine you need to place the contents of id_rsa.pub at the end of the $HOME/.ssh/authorized_keys file. If you don't have an authorized_keys file then create one by copying id_rsa.pub there. You will need to use other means than scp to get it there.

Additionally your $HOME/.ssh directory on both machines needs to have good permissions, this is "chmod 700 .ssh" on a unix machine.

  • i have ssh keys. That's not a problem. – 112233 Jan 07 '20 at 02:36
  • the ppk key that you have with the -i is putty format (ppk). scp is openssh. You need keys in ssh format using ssh-keygen, or find a converter between putty keys and openssh keys. – parallelsignal Jan 07 '20 at 02:37