Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Elastic Beanstalk - changing owner of webapp folder

I've successfully created an application using AWS Elastic Beanstalk and have uploaded the app using Git.

All that's left for me to do is create my settings.php file and everything should work.

However when I connect via SSH as the user ec2-user using the method documented at SSH to Elastic Beanstalk instance I cannot navigate into the webapp directory. Here is output of ls -all

drwxr-xr-x  4 root     root     4096 Feb 10 16:21 .
dr-xr-xr-x 23 root     root     4096 Feb 10 16:23 ..
drwx------  3 ec2-user ec2-user 4096 Feb 10 16:41 ec2-user
drwx------  2 webapp   webapp   4096 Feb 10 16:21 webapp

And when I try to navigate there I get:

cd: webapp: Permission denied

My question is, can I change the ownership of the webapp folder to that of ec2-user. If I do, will I break Elastic beanstalk? If so, I'd be interested to know how anyone else achieves what I am looking to do, which is not skip the Git deploy of a settings file so that it can be different on my local machine from that of the version on Amazon.

like image 904
Paul Avatar asked Jan 12 '23 05:01

Paul


2 Answers

Changing the owner will probably break your Elastic Beanstalk deployment. However, you could add your user to the webapps group and change the permissions to rw on the folder recursively so that anyone in the webapps group can read/write on that folder

chmod -R g+rw webapp

If so, I'd be interested to know how anyone else achieves what I am looking to do, which is not skip the Git deploy of a settings file so that it can be different on my local machine from that of the version on Amazon.

Can you elaborate on this ? What settings file ? Do you mean 'skip' or 'not skip' ?

like image 143
Rico Avatar answered Jan 16 '23 21:01

Rico


The permissions of the ec2-user are restricted, and probably not identical to the user running your application. Use the Unix sudo command to perform administrator tasks when you're logged on to your EC2 instance:

$ sudo ls webapp

Then you're able to easily see how things are set up, and perform any actions you please. Just keep in mind that anything you DO perform, may become undone if the instance is recreated. Therefore, you may need to use .config files, should you automatically want this file to appear on any new EC2 nodes created by Elastic Beanstalk.

Good luck!

like image 23
joker Avatar answered Jan 16 '23 21:01

joker