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?

Rinzwind
  • 299,756

2 Answers2

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

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
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!