Change read/write access of a folder in Ubuntu Linux
Asked Answered
A

1

8

I want to create a folder and write a file in the created folder in an Amazon EBS volume from a Java Servlet installed on Amazon EC2 running Ubuntu.

I have mounted the EBS volume at

/mnt/my-address

But the Servlet is unable to create the folder and write the file?

My Question

Why Java sevlet is not able to create a folder on Amazon EBS mounted volume?

Ambler answered 11/8, 2012 at 21:25 Comment(6)
Do you see any error message in the log files of your servlet container ?Sulfonation
@DavidLevesque I checked the folder is not created.Ambler
Yeah... I was asking if there is any error message...Sulfonation
@DavidLevesque No there was no error on catalina.outAmbler
And no error in the file localhost.<date>.log ?Sulfonation
@DavidLevesque The error is while reading the file. To me it looks like, the user running tomcat does not have permission to create folder and write files. How to give such permission to user for folder /mnt/my-address seems to be the question?Ambler
S
29

Looks like your folder does not have the correct read/write permissions.

Try granting read-write access to all users to the directory in question, e.g.:

sudo chmod -R ugo+rw /mnt/my-address

If you are uncomfortable with granting write permissions to all, you could fine tune the permissions by playing with ownership and groups, but I would need more info about your setup to help you with that.

Edit: if the ec2-user is the only one needing access, you could change the ownership of the directory to that user and then grant access to only him:

sudo chown -R ec2-user:ec2-user /mnt/my-address
sudo chmod -R u+rw,go-rw /mnt/my-address
Sulfonation answered 12/8, 2012 at 19:9 Comment(1)
+1, thanks, what more info do you need? The user running tomcat is ec2-user.Ambler

© 2022 - 2024 — McMap. All rights reserved.