Change the directory it’s mounted TO’s ownership and permission before the mount is done.
$ /usr/bin/ls -lah /mnt
drwxr-xr-x 4 mirdarthos mirdarthos 4.0K Jun 16 12:00 4tb_backup
drwxr-xr-x 12 mirdarthos mirdarthos 4.0K Jan 24 2022 5TB
Inside those I’ve mounted my 2 hard drives:
systemd-1 on /mnt/4tb_backup type autofs (rw,relatime,fd=48,pgrp=1,timeout=10,minproto=5,maxproto=5,direct,pipe_ino=22542)
/dev/sda1 on /mnt/5TB type ext4 (rw,relatime)/dev/sda1 on /mnt/5TB type ext4 (rw,relatime)
The 4TB is an automounted one. With the following systemd unit files:
It might be an ‘of course’ situation for you since you know what to do. I on the other hand, do not, hence my original post. What options would you be referring to? I guess that should be applied to the .mount file.
The previously posted tutorials by @Mirdarthos do not show how to do that, except for on a network drive, which mine is not, and I’m not sure whether or not those options are applicable or safe in a different environment. I don’t want to try adding options randomly in case I brick something.
Well, I’ll look into uid. I misunderstood since I have use uuid.
I used the options shown in the tutorial for a disk that is not networked. uid is featured in the network share section, mine is not a network drive and it says that uid and gid cause errors. The Disk Partition section has no mention of those.
UserID is not the same as UniversallyUniqueID. The former identifies a user, the latter identifies a partition.
The options are for the filesystem.
Most of those examples use ext4 which is a native filesystem. You’re using ntfs which is not a native filesystem, ie it doesn’t have the same permissions.
In order to match ntfs permissions to linux permissions you need to provide a UserID and GroupID for the user and group which you want to own it, and perhaps also define the permissions which should apply.
Once I knew what to look for, @zbe, I followed the trail.
The second tutorial posted by @Mirdarthos threw me a bit because it looked like uid and gid were specific to samba. @dmt mentioning permissions led me to umask.
The searches put me onto fstab first, then I found out that mount uses the same options as fstab.
The final .mount works like this.
Description=Mount Webdev disk (/automounts/webdev)
drwxrwxrwx 1 leebut leebut 28672 Nov 3 09:28 webdev
Perhaps I should change the umask to 0003 so that root and I have full access but others can only read. I think that’s how it works.
Another thing I needed to do was to include the exec option to the .mount file since, noexec was set and Kivy (a python program) was not working properly (executing something) on the auto-mounted partition but worked on the home partition.