/mnt permissions keep changing on EC2 instances

0

I have a few Ubuntu instances on EC2 where I use the /mnt instance storage to keep logs and other fungible stuff. In order to store user logs the /mnt directory needs to have 777 permissions:

$ sudo chmod 777 /mnt

But periodically (about daily) permissions revert back to 755, for no apparent reason. Is there any way to make /mnt have write permissions for all users -- and keep it that way? I already have a task that runs on startup with the above line, but apparently it does not work.

A periodic task would be a last resort; honestly, I would like to understand the problem and solve it correctly. I have searched here and on the intertubes, no luck so far -- it is not an easily googleable question anyway.

Perhaps some mount options would do the trick? My fstab:

/dev/xvdb       /mnt    auto    defaults,nobootwait,comment=cloudconfig 0       2

alexfernandez

Posted 2013-09-13T22:27:52.030

Reputation: 103

What filesystem is on the volume being mounted? You should almost never have permissions set to 0777. That strongly indicates you are doing something wrong. – Zoredache – 2013-09-13T22:55:47.310

1Can you just create a sub-directory to /mnt that will have the permissions you need? – ernie – 2013-09-13T23:01:37.800

@Zoredache Possibly, in that case I would like to know how to do things right. – alexfernandez – 2013-09-14T07:41:25.347

@ernie I suppose so, but I would need to recreate that directory on boot using a task. I am already setting permissions to 777 in a task and it is not working. I would like to know what is wrong so that I can be sure that any new scheme works without mucking around. – alexfernandez – 2013-09-14T07:44:43.297

I'm not sure what's resetting the mount points permissions (I'd guess something with how ephemeral storage works on EC2), but I'd guess that it won't change permissions on subdirectories . . . – ernie – 2013-09-15T17:06:28.483

@ernie I suppose that it will have to do. If you send an answer I will accept it then. – alexfernandez – 2013-09-16T07:32:43.857

Answers

1

While I'm not sure what's causing the permissions to reset (I would guess it's a policy around the ephemeral storage on an EC2 instance), but I think a more secure way to handle this would be to create a directory on /mnt with the permissions you need.

My theory is that this directory would not have it's permissions changed by whatever maintenance Amazon is running, plus it's more secure.

ernie

Posted 2013-09-13T22:27:52.030

Reputation: 5 938