Transfer Files to a Linux AWS EC2 Instance using .Pem File from Mac Os – Permission Denied Error
- July 31, 2024
- Posted by: admin
- Categories:
No Comments
Scenario
- You have created a linux instance on Linux
- You are using a mac os laptop
- You need to copy files to the instance from your machine
- You are accessing your instance via SSH using .pem file
- You wish to transfer files to the linux instance using the .pem file
- You run this command to transfer the files: scp -i dicivic.pem home.html [email protected]:/var/backups
- You get the error below: Permission Denied
Solution
- 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!