-1

I am trying to fix a problem I have with my program I uploaded to AWS in elastic beanstalk tomcat. I found someone who seems to have had a similar problem, but I can't find where I execute their solution.

AWS EC2 tomcat permission denied creating/writing to file

The answer said that I should use the following commands:

    chmod o+x /home
    chmod o+x /home/ec2-user

I want to see if this will fix my problem, however I have looked everywhere and have found no information regarding where I actually put these commands.

Community
  • 1
  • 1

1 Answers1

0

Is your problem fixed if you run those commands manually? (i.e. eb ssh into your instance and then sudo chmod o+x /home then sudo chmod o+x /home/ec2-user)

If so, you could automate running those commands using an EB extension file. The documentation is here but it would look something like this:

.ebextensions/01-fix-permissions.config

commands:
  fix_home_permissions:
    command: "chmod o+x /home"
  fix_ec2user_permissions:
    command: "chmod o+x /home/ec2-user"
Brian
  • 5,300
  • 2
  • 26
  • 32
  • After reading through some more documentation here is my understanding of one way I could set up and include those commands. Add a folder called .ebextensions in my maven project in eclipse. Create a .config file and put it in this folder. Run maven install to get the .war file and then update my AWS web app with the new file. – Dane Williams Apr 10 '17 at 16:16
  • Yes, if you create `.ebextensions/01-fix-permissions.config` and then deploy your WAR it should do what you want. – Brian Apr 10 '17 at 16:29
  • I tried uploading my war file as I previously described and am still getting the same error. Does the .war not include these changes? Do I need to create a .zip instead to include them? – Dane Williams Apr 11 '17 at 16:23
  • Update: tried as a .zip and also have the same error – Dane Williams Apr 11 '17 at 16:39
  • If you run the `chmod` commands manually, does your original problem go away? If so, please post your `/var/log/eb-activity.log`. – Brian Apr 11 '17 at 17:56
  • Where do I go to run them manually? Also, I came back to AWS this morning and found that it actually was not the same. Apparently I tested it before it was entirely finished deploying. In AWS "recent events" it says `The configuration file __MACOSX/.ebextensions/._01-fix-permissions.config in application version ARFormzip contains invalid YAML or JSON. YAML exception: Invalid Yaml: unacceptable character '' (0x0) special characters are not allowed in "", position 0, JSON exception: Invalid JSON: Unexpected character () at position 0.. Update the configuration file.` – Dane Williams Apr 12 '17 at 16:06
  • My file contains exactly what you posted in the answer right now. – Dane Williams Apr 12 '17 at 16:09
  • UPDATE: I fixed my formatting problem in accordance to this [post](http://stackoverflow.com/questions/10924236/mac-zip-compress-without-macosx-folder) Now I get an error that is gives practically no information at all: HTTP status 404 Type: status report Message: /_ Description: the requested resource is not available. :( – Dane Williams Apr 12 '17 at 17:12
  • You can try executing the commands manually by using `eb ssh` to log into your instance and running `sudo chmod o+x /home` and `sudo chmod o+x /home/ec2-user`. – Brian Apr 13 '17 at 14:02
  • Got it. Not fixing the issue so I'm going to need to continue searching for the bug. Do I have to do these commands in EB CLI everytime I upload an updated war file in order for them to continue to apply? – Dane Williams Apr 14 '17 at 15:44
  • If you run the commands manually, the effects should persist until the instance is terminated - if a new instance is created (either manually or via auto-scaling) then you'd need to re-run the commands. If you put the commands in `.ebextensions/01-fix-permissions.config`, however, they will be automatically run as part of each deploy. – Brian Apr 24 '17 at 18:58