1

I am trying to extract some .pem certificates files used to encrypt my server but for some reason cannot do it using SCP

I am unable to copy them over to my own machine

Error

Here are the files in the EC2 instance

ls -la output

Not sure why they are showing as red, but after some reading saw that it means they are zipped

Errors when executing SCP command:

scp: /home/ec2-user/certificates/fullchain.pem: No such file or directory
scp: /home/ec2-user/certificates/privkey.pem: No such file or directory
scp: /home/ec2-user/certificates/chain.pem: No such file or directory
scp: /home/ec2-user/certificates/cert.pem: No such file or directory

Edit: Moved to another directory and copied again, set permissions to 777 using

sudo chmod 777 -R falltoyourdeathbe.co.uk/

but still cannot copy - any ideas? They are still showing as an archive no idea why scp still not working on .pem files but fine on readme

Edit 2: Various commands run to show that there is not a /home/archive directory and that the folder with the certificates now sits under /home/ec2-user/ Another screenshot

user2921885
  • 159
  • 11
  • 1
    This is probably a superuser/serverfault question. Can you update your post with the text copied and pasted from your terminal not images. Also, run `ls -la` so it includes permissions and ownership of the files. – MisterSmith Apr 27 '21 at 20:26
  • Hey @mistersmith - updated question with info for you – user2921885 Apr 27 '21 at 21:25
  • Looks like a permission issue..user `ec2-user` cant access `/home/archive` – MisterSmith Apr 27 '21 at 21:42
  • I'm wondering if you're symlinks are not broken. Try `find . -xtype l` in `/home/ec2-user/certificates`. If your `.pem` file appear it means those links are broken. Maybe you moved your files in a different location than `../../archive/falltoyourdeathbe.co.uk/` (or deleted them). Find out where those files went and recreate the links (using `ln -s`). – Fritzip Apr 27 '21 at 22:53
  • @MisterSmith Any ideas?? – user2921885 May 05 '21 at 17:19
  • or @Fritzip - I have tried changing permissions under a new directory /home/ec2-user/falltyourdeathbe.co.uk ----> .pem files and README here but only the README can be transferred over using SCP – user2921885 May 05 '21 at 17:20
  • 1
    Its a permissions problem. The pem files live in /home/archive/..., the broken symlinks your seeing are inside /home/ec2-user but they point to files in /home/archive. The user ec2-user needs permission to read the actual files in /home/archive, or you need to move the pem files to a location where ec2-user can access them (somewhere inside /home/ec2-user). – MisterSmith May 05 '21 at 17:45
  • These files are inside /home/ec2-user because they sit at /home/ec2-user/falltoyourdeathbe.co.uk and I have tried giving the folder 777 permissions but still the same error on the pem files. How do I cd into /home/archive? I cannot even see this directory under /home/ - I will leave another screenshot – user2921885 May 05 '21 at 18:07

0 Answers0