Right now /mnt/resource is owned by root and only root can read/write. How can I make this readable/writable by other users on the system?
And this should be persistent (i.e. after system restart it should still work)
Right now /mnt/resource is owned by root and only root can read/write. How can I make this readable/writable by other users on the system?
And this should be persistent (i.e. after system restart it should still work)
To do this you need to use a command similar to the following:
Based on this documentation, the Azure Linux Agent (/usr/sbin/waagent) does the following:
Upon provisioning an instance (starting/restarting) the device
/dev/sdb1
will be mounted by waagent upon boot based on the settingResourceDisk.MountPoint=
in/etc/waagent.conf
, defaulting to/mnt/resource
. You can verify this by typing the commandcat /var/log/waagent.log | grep sdb1
after stopping and starting an instance should show something like this:Because waagent creates the mount some time after the boot, setting permissions immediately upon boot will not work. (I've experienced a race condition where I created a directory in
/mnt/resource
only to have it deleted when the mount occurs.)You can create a service which will wait until
/dev/sdb1
is mounted to/mnt/resource/
then change permissions as needed.One way would be to have a script similar to the following run as an init script:
Chown and Chmod are the commands to achieve this.
Probably easier just to read this https://en.wikipedia.org/wiki/Chmod
/mnt/resource WILL NOT PERSIST no matter what you do with it Documentation