Friday, May 6, 2022

[SOLVED] chmod configuration in elastic beanstalk

Issue

I am attempting to restrict access to a few backend folders in an elastic beanstalk environment, but I cannot figure out how to set chmod permissions in an existing environment.

I am aware that there may be a way to do this through the .ebextensions file, but I have been unable to find a resource outlining this process.

How do I restrict folder access to folders and files in my elastic beanstalk environment?

Thank you!


Solution

There is a setting you can use in the .ebextenstions file called "files". I haven't tested this with folders though and I am not sure if you can change permissions on already existing files and folders with it.

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-files

You could just add a command that does it though.

    commands:
      01_set_file_permissions:
        command: "chmod 600 /path/to/file"


Answered By - Gustaf
Answer Checked By - David Goodson (WPSolving Volunteer)