I am trying to configure an ubuntu vps. I have set up ssh secure login using rsa public and private keys from a local machine.
As well as disabling root login I have also set up iptables and configured to allow ports 80 and 22 (port 22 only from my ip address) for the ssh tunnel.
I can connect fine using ssh but when I try using scp from my local machine
sudo scp /var/www/filetocopy user@remoteaddress:/var/www/filetocopy
I get this error
Permission denied (publickey).
Does this mean that I have to generate another public key/private key pair or is there a way of using the key that the ssh uses?
many thanks in advance
Best Answer
SCP works over SSH so there shouldn't be any additional setup or configuration. Throw a
-v
in there afterscp
and let's get some more information.That said, it looks like the SCP command isn't passing the key you generated. Try specifying the key file with the
-i
option. If it is in a non-standard location or non-standard name you'll need to let it know what to use rather than the default ~/.ssh/id_rsa.