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년 전6248회 조회
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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠