Caroline Ininga

Transfer Files to a Linux AWS EC2 Instance using .Pem File from Mac Os – Permission Denied Error

Scenario

  1. You have created a linux instance on Linux
  2. You are using a mac os laptop
  3. You need to copy files to the instance from your machine
  4. You are accessing your instance via SSH using .pem file
  5. You wish to transfer files to the linux instance using the .pem file
  6. You run this command to transfer the files: scp -i dicivic.pem home.html [email protected]:/var/backups
  7. You get the error below: Permission Denied

Solution

  1. When you first create an instance, the default files are owned by root

2. You need to change the the ownership of the directory you want to transfer files to the user you are using. The command to change the onwership is: sudo chown -R ubuntu:ubuntu /var/backups

3. Now when you run the command again to transfer the file, it works!



Leave a Reply