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
  • 293,910
  • 41
  • 570
  • 710
Maqsud Inamdar
  • 123
  • 2
  • 6
  • 1
    Hello, are you able to connect to the server over ssh? – pa4080 Mar 12 '20 at 07:51
  • I am using GC Compute Engine. I am able to connect using SSH button on VM Instance on GC – Maqsud Inamdar Mar 12 '20 at 07: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 '20 at 08:31
  • See for instance https://askubuntu.com/questions/803908/how-do-i-add-an-ssh-key-to-a-google-compute-cloud-vps-instance But be careful. Doing it incorrectly can lock you out. – Rinzwind Mar 12 '20 at 08:33
  • I am not able to rdp my ubuntu VM instance which i have created on Google Cloud getting following error https://prnt.sc/rf91cq – Maqsud Inamdar Mar 12 '20 at 13:41
  • 1
    Does this answer your question? [Filezilla or WinSCP alternative for Ubuntu](https://askubuntu.com/questions/987769/filezilla-or-winscp-alternative-for-ubuntu) – pa4080 Mar 12 '20 at 13:50

2 Answers2

0

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
  • 35,476
  • 25
  • 95
  • 181
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!