Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change read/write access of a folder in Ubuntu Linux

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?

like image 875
Gaurav Agarwal Avatar asked Aug 11 '12 21:08

Gaurav Agarwal


People also ask

How do I change folder permissions in Ubuntu?

Type “sudo chmod a+rwx /path/to/file” into the terminal, replacing “/path/to/file” with the file you want to give permissions to everyone for, and press “Enter.” You can also use the command “sudo chmod -R a+rwx /path/to/folder” to give permissions to the selected folder and its files.

What is the meaning of chmod 777?

777 - all can read/write/execute (full access). 755 - owner can read/write/execute, group/others can read/execute. 644 - owner can read/write, group/others can read only.


1 Answers

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
like image 77
David Levesque Avatar answered Sep 24 '22 20:09

David Levesque