2

I tried the following command using my Mac Terminal

scp -rp /path/file user@SERVER_IP:/path/destination/folder

It gives me following error:

user@SERVER_IP: Permission denied (public key).
lost connection

Is there any ports that i am missing to open?

6
  • 1
    Hello, are you able to connect to the server over ssh?
    – pa4080
    Mar 12, 2020 at 7:51
  • I am using GC Compute Engine. I am able to connect using SSH button on VM Instance on GC Mar 12, 2020 at 7:57
  • 2
    "Is there any ports that i am missing to open?" no you are missing a public key. Please read up on how security works in regards to scp.
    – Rinzwind
    Mar 12, 2020 at 8:31
  • See for instance askubuntu.com/questions/803908/… But be careful. Doing it incorrectly can lock you out.
    – Rinzwind
    Mar 12, 2020 at 8:33
  • 2
    Does this answer your question? Filezilla or WinSCP alternative for Ubuntu
    – pa4080
    Mar 12, 2020 at 13:50

2 Answers 2

1

Normally, scp asks for a password. To avoid this, or to automate file copying in scripts, public key authentication is usually used. The basic idea is to create a key pair on the client and copy the public key to the server into an authorized keys file.

Sources: https://www.ssh.com/ssh/scp#configuring-public-key-authentication

0

No you are not missing any ports.

Here is an answer:

You need to check if the remote directory(Where you are posting) has permissions for other users.

If not, run: sudo chmod 777 [remote directory]

This should work!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .