transfer file to remote via cmd

749 Views Asked by At

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 [email protected]:/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 [email protected]:/C:/Users/myself/Documents/personal/gd_bundle-g2-g1.crt   /etc/ssl/certs

Getting error : wrong format

1

There are 1 best solutions below

2
On

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.