Wednesday, August 17, 2022

mount_ntfs(8) -u/-g problem?

Hi,

I'm running:

OpenBSD victim.blackhelicopters.org 7.2 GENERIC.MP#640 amd64

According to mount_ntfs(8), -u and -g let you set UID and GID of
mounted filesystems. Took an NTFS USB drive, plugged it in, mounted
it, and checked ownership.

# mount_ntfs -u mwlucas -g mwlucas /dev/sd4i /mnt/
# ls -lai /mnt/
total 107
4 -rwxr-xr-x 1 root wheel 2560 Dec 31 1600 $AttrDef
8 -rwxr-xr-x 1 root wheel 0 Dec 31 1600 $BadClus
6 -rwxr-xr-x 1 root wheel 32768 Dec 31 1600 $Bitmap
7 -rwxr-xr-x 1 root wheel 0 Dec 31 1600 $Boot
11 drwxr-xr-x 1 root wheel 0 Aug 17 15:05 $Extend
2 -rwxr-xr-x 1 root wheel 0 Dec 31 1600 $LogFile
1 -rwxr-xr-x 1 root wheel 0 Dec 31 1600 $MFTMirr
9 -rwxr-xr-x 1 root wheel 0 Aug 17 15:05 $Secure
10 -rwxr-xr-x 1 root wheel 131072 Dec 31 1600 $UpCase
3 -rwxr-xr-x 1 root wheel 0 Dec 31 1600 $Volume
5 drwxr-xr-x 1 root wheel 0 Dec 31 1600 .
2 drwxr-xr-x 15 root wheel 512 Aug 16 13:02 ..
36 drwxr-xr-x 1 root wheel 0 Aug 17 15:05 System Volume Information
38 -rwxr-xr-x 1 root wheel 111496224 Aug 17 13:35 VirtualBox-6.1.36-152435-Win.exe

If I create /tmp/mnt owned by mwlucas:mwlucas and mount there,
ownership of the mount point is changed to root:wheel and the files
are owned by root.

# chown mwlucas:mwlucas /tmp/mnt
ls -lai /tmp/
total 1
2 drwxrwxrwt 9 root wheel 512 Aug 17 15:42 .
2 drwxr-xr-x 15 root wheel 512 Aug 16 13:02 ..
25920 drwxrwxrwt 2 root wheel 512 Aug 16 13:02 .ICE-unix
388800 drwxrwxrwt 2 root wheel 512 Aug 16 13:02 .X11-unix
77760 drwxr-xr-x 2 mwlucas mwlucas 512 Aug 17 15:42 mnt
259200 drwxr-xr-x 2 root wheel 512 Aug 16 13:02 sndio
...

# mount_ntfs -u mwlucas -g mwlucas /dev/sd4i /tmp/mnt/

# ls -lai /tmp/mnt/
total 107
4 -rwxr-xr-x 1 root wheel 2560 Dec 31 1600 $AttrDef
8 -rwxr-xr-x 1 root wheel 0 Dec 31 1600 $BadClus
6 -rwxr-xr-x 1 root wheel 32768 Dec 31 1600 $Bitmap
7 -rwxr-xr-x 1 root wheel 0 Dec 31 1600 $Boot
11 drwxr-xr-x 1 root wheel 0 Aug 17 15:05 $Extend
...

Am I doing something wrong here, or did I find a bug?

FWIW, mount_msdos -u and -g assigns ownership.

Thanks,
==ml



--
Michael W. Lucas https://mwl.io/
author of: Absolute OpenBSD, SSH Mastery, git commit murder,
Absolute FreeBSD, Immortal Clay, Prohibition Orcs, etc, etc, etc...
### New books: TLS Mastery, the Networknomicon, $ git sync murder ###

No comments:

Post a Comment