I am running a server on AWS that requires a storage volume to be mounted on an as-needed basis. I need 'normal' users (those without any sudo privileges etc.) to be able to mount this drive and perform necessary actions.
To do so, I did:
- Create a group called
sudo groupadd xyz
- Added my user to this group:
sudo usermod -a -G xyz sriram
/etc/sudoersfile like so:
%xyz ALL=/bin/mount /dev/xvdg, /bin/umount /dev/xvdg
However, when I try to mount the drive with:
mount /dev/xvdg data
I get the error:
only root can do that...
sudo to the above command did not solve issues as user
sriram is not part of the
wheel group either.
I also read through some posts online that suggest adding user details in
/etc/fstab. That would allow me to mount this drive without sudo. However, this is not my use case. I want to be able to mount the drive on an as-needed basis
How do I solve this? Where am I going wrong?