-1

I installed shiny server on an AWS EC2 Ubuntu instance following instruction here: https://www.rstudio.com/products/shiny/download-server/

I tried to transfer a folder to a remote directory: /srv/shiny-server by typing in terminal:

scp -r path/Publickey path/folder ubuntu@ec2-52-15-128-161.us-east-2.compute.amazonaws.com:/srv/shiny-server

Then I got:

Permission denied (publickey).
lost connection

Any help will be appreciated!

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
Hao Yang Wu
  • 3
  • 1
  • 2

1 Answers1

0

It looks like the key that was being used is not accepted for the user ubuntu on your server. If path/Publickey is your key and the key is in ~ubuntu/.ssh/authorized_keys, you'll need the -i flag. Without it, ssh will look in the user's default (i.e. ~/.ssh/id_rsa). This should do it:

scp -i path/Publickey -r path/folder ubuntu@ec2-52-15-128-161.us-east-2.compute.amazonaws.com:/srv/shiny-server
K Richardson
  • 201
  • 2
  • 8
  • I checked the ~ubuntu/.ssh and the authorized_keys indeed is there. Then I run your command but get: scp: /srv/shiny-server/mdminer: Permission denied. At least it looks like I have got a step closer, and what can I do next? – Hao Yang Wu Nov 04 '16 at 01:28
  • It looks like it is now authenticating, but the ubuntu user doesn't have permission to write to that folder. First, make sure it exists, then ubuntu has rwx permissions. After that, you should be good! – K Richardson Nov 04 '16 at 03:19
  • I rewrite it with chmod 777 and it's fine now! – Hao Yang Wu Nov 04 '16 at 15:09