Permission issues with tomcat7 on EC2

amazon ec2file-permissionspermissionstomcat7user-permissions

I finally managed to deploy my web service on to ec2 with tomcat 7 installed. It works perfectly fine on localhost but is receiving errors on ec2. I think it is because my code generates an xml file which it then tries to parse. I think perhaps permissions need to be set on the directory so when the file is created it can be read by my code. Could anyone help me set this rule please?

Secondly, to try and diagnose this error I tried to cd into the logs directory in tomcat. I received permission denied. I tried to run chmod on the directory but I still get permission denied. Can anyone help me set this up please?

EDIT: I have been tearing my hair out over this and have ran out of stuff to try. I tried to drop the instance and make a new one so I don't think it is to do with how I created it.

EDIT 2: I have managed to get into my logs folder by doing sudo su cd logs. That solution will do for now. Would still appericiate help with the first issue.

Thanks,
Matt

Best Answer

Ok, I may not have found an exact answer to my questions but I found workarounds for both.

To get into the logs (Amazon EC2 doesn't let me login as root for some reason) I used sudo su to become root. Then when I cd into logs I am successful.

The file being generate by my java was not being put into the webapps folder as I was expecting (and as it did on local host). The web apps folder has weird permissions and they don't seem to change with chmod. I therefore moved the generation of the file to the home directory of the ec2-user, and also read it from there.

This resolves both my issues.