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年前6250ビュー
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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ