I am using dietpi-drive_manager for mounting external hard-drives and usb-drives. However I am facing the following issues.
The mounted disks are mounted using root permissions. So, I have to become root to be able to access the mounted location and files therein. Is this normal ? Is there a way to mount them as normal (currently logged in) user ? I have tried the method, wherein the generated fstab entry can be modified with userid and gid options to get this working. But this is very cumbersome to do for every new drive that is mounted. Is there any other method ?
How to automatically mount usb drives/hard drives when they are plugged in ? Regular Ubuntu OS mounts them automatically (I believe using autofs). Can dietpi use autofs or does dietpi-drive_manager has this capability ?
Only the root user can mount, this is default linux behaviour.
You can just change the file permissions or the ownership of the drive like you need them (with chown or chmod), independent from the mount process. But this will only work for linux filesystems like ext4.
If you mount NTFS, exFAT or other non-linux file sytems, then there is no way around as to edit the fstab. Or the user uses sudo, but this is a bit cumbersome.
For the USB drive, I have vfat, and for Hard drive I have ext4.
You can just change the file permissions or the ownership of the drive like you need them (with chown or chmod), independent from the mount process. But this will only work for linux filesystems like ext4.
Is the above true for all Linux OSes ? Because, in a regular Ubuntu system, when I plug a usb drive, the drive is readily usable by the user that mounted. There is no necessity for the root to mount it and change the permissions. How is this achieved ?
vfat is not a Linux file system. For this we usually use user dietpi. You can have a look to /etc/fstab.
For ext4, it depends on the permissions of the folders themselves. They are kept from before. They are not changed. Just have a look to the folder in question.