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)
How to make /mnt/resource readable/writable but other users in Azure Linux VM?
To do this you need to use a command similar to the following:
chown other_user /mnt/resource
And this should be persistent (i.e. after system restart it should still work)
Based on this documentation, the Azure Linux Agent (/usr/sbin/waagent) does the following:
• Manages the resource disk
• Formats and mounts the resource disk
Upon provisioning an instance (starting/restarting) the device /dev/sdb1
will be mounted by waagent upon boot based on the setting ResourceDisk.MountPoint=
in /etc/waagent.conf
, defaulting to /mnt/resource
. You can verify this by typing the command cat /var/log/waagent.log | grep sdb1
after stopping and starting an instance should show something like this:
2016/06/17 09:06:42 Resource disk (/dev/sdb1) is mounted at /mnt/resource with fstype ext4
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:
#!/bin/sh
LOG=/tmp/startup.log
while [ `mount | grep /mnt/resource | wc -l` -lt 1 ];
do
echo "Waiting for mount to be created by waagent..." >> ${LOG}
sleep 5
done
echo "Changing /mnt/resource permissions..." >> ${LOG}
chown other_user /mnt/resource
/dev/sdb1
is the mount point for the local scratch disk. It is not relevant when mounting an attached disk. And waagent
doesn't impact mounted disks.
Jun 17, 2016 at 20:46
waagent
doesn't mount the disk as I have described, can you please explain to me what does make the mount?
Chown and Chmod are the commands to achieve this.
Probably easier just to read this https://en.wikipedia.org/wiki/Chmod