I have an automounted (by systemd) partition that I’d like to change from root ownership to my own user.
I have tried root chown leebut:leebut web but the owner and group remain as root.
The reason for the change is that I’m using buildozer, but it fails to build, and I saw that directory ownership may be a problem.
I’m thinking that perhaps it’s not possible since the system is mounting the drive.
I am a member of leebut, and another not automounted drive is owned by leebut.
Change the directory it’s mounted TO’s ownership and permission before the mount is done.
$ /usr/bin/ls -lah /mnt
total 36K
[...]
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:
$ mount
[...]
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:
Hold your horses, I had to do some life things, and my wife is ordering me to read stories to my son, so I don’t know yet.
I’ve just disabled the mount and automount files, rebooted, and drive reverted back to leebut ownership. While I was at it, I changed the name and label to one without spaces.
drwxrwxrwx 1 leebut leebut 28672 Nov 3 09:28 WebDev
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, @anon51566685, 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.
[unit]
Description=Mount Webdev disk (/automounts/webdev)
[Mount]
What=/dev/disk/by-uuid/01D5A3BB92BBCA10
Where=/automounts/webdev
Type=ntfs
Options=defaults,user,rw,noatime,group,uid=1000,gid=1000,umask=0000
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.