更改文件夹的Ubuntu Linux操作系统的读/写访问文件夹、操作系统、Ubuntu、Linux

2023-09-11 10:47:08 作者:X丶Man◇主流

我要在创建的文件夹中的亚马逊EBS创建一个文件夹,并写入一个文件从一个Java servlet卷安装在Amazon EC2上运行Ubuntu。

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.

我已经安装了EBS卷在

I have mounted the EBS volume at

/mnt/my-address

但Servlet是无法创建文件夹并写入文件?

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

我的提问

为什么的Java sevlet无法创建文件夹在Amazon EBS安装的卷?

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

推荐答案

看起来你的文件夹没有正确的读/写权限。

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.

修改:如果EC2用户是唯一一个需要访问,你可以改变目录的所有权给用户,然后授予仅他访问:

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