Why is an rw EFS mounted on EC2 not allowing file or folder creation?

0

I created an EFS and mounted it on a free tier Amazon Linux 2 AMI (HVM) EC2 instance. I'm able to SSH into the EC2 instance, and I can navigate into /mnt/efs/fs1. However, when I do an mkdir abc in the /mnt/efs/fs1 folder, I get the error mkdir: cannot create directory ‘abc’: Permission denied.
If I run mount -t nfs4, I get the output:
_127.0.0.1:/ on /mnt/efs/fs1 type nfs4 (rw,relatime,vers=4.1,rsize=1048576,wsize=1048576,namlen=255,hard,noresvport,proto=tcp,port=20240,timeo=600,retrans=2,sec=sys,clientaddr=127.0.0.1,local_lock=none,addr=127.0.0.1,netdev)

I've seen a page about the AWS transfer family, but the steps aren't clear and it looks like it's not meant for the purpose I need it for. I basically need to create a few folders in EFS and copy some files from my PC to those folders on EFS. Since AWS does not provide a drag-and-drop option like Google Drive, I'm having to use SSH. But I'm not even able to create a directory on the mounted folder.
Please help.

Navnav
已提問 3 年前檢視次數 6252 次
2 個答案
1

If you want to create a folder inside the EFS volume that is owned by a user on the EC2 instance, you could do the following (assuming you are logged in as ec2-user):

  1. cd /mnt/efs/fs1
  2. sudo mkdir your-folder-name
  3. chown -R ec2-user:ec2-user your-folder-name

This will use root privileges to create new folder within the EFS volume and then assign ownership to another user, in this case the default ec2-user that you will get when you create an EC2 instance using Amazon Linux 2.

profile pictureAWS
micah
已回答 2 年前
  • need to preface chown with sudo as well

0
已接受的答案

It's possible that you are trying to create the directory as a non-root user, while /mnt/efs/fs1 is owned by root.

Please see https://docs.aws.amazon.com/efs/latest/ug/accessing-fs-nfs-permissions.html - you can either change the permissions on your directory as root (with sudo) or use an access point.

AWS
已回答 3 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南