Haines Brown via Dng <dng@???> writes:
> I want to add a mount point owned by user to /media
>
> $ mkdir /media/working
>
> $ ls -la /media | grep working
> drwxr-xr-x 2 haines haines 4096 Mar 2 08:05 working
>
> I mount a USB key on that mount point. I plug it in and do:
>
> # dmesg
> ...
> sdc: sdc1
> sd 7:0:0:0: [sdc] Attached SCSI removable disk
> FAT-fs (sdc1): Volume was not properly unmounted. Some data may
> be corrupt. Please run fsck.
>
> The error because I originally pulled the key without first
> unmounting it. Assume error irrelevant.
It's very likely irrelevant to your issue, but running fsck on the
device before mounting it would be a goot idea.
>
> I mount the key:
>
> $ sudo mount /dev/sdc1 /media/working
>
> Now comes the trouble
>
> $ ls -la /media
> total 32
> drwxr-xr-x 6 haines haines 4096 Mar 2 08:14 .
> drwxr-xr-x 28 root root 4096 Feb 16 14:29 ..
> drwxr-xr-x 2 haines haines 4096 Jan 8 09:22 cdrom
> drwxr-xr-x 2 root root 4096 Dec 22 12:50 Elements
> drwxrwxr-x 2 root users 8192 Dec 31 1969 usbhd-sdc1
> drwxrwxr-x 2 root users 8192 Dec 31 1969 working
>
> The mount command creates the strange usbhd-sdc1 mount point
> and mounts /dev/sdc1 on it as well as on the working mount
> point. /dev/sdc1 is mount twice:
This suggests that something on your system (auto-)mounted /dev/sdc1 to
/media/usbhd-sdc1 in respons to the UDB stick being plugged in.
[...]
> Also the owner of the working directory by mounting /dev/sdc1 becomes
> root:users,
[...]
> How can the mount command change ownership of a mount point?
That's the intended behaviour: The mount point directory gets replaced
with the root directory of the mounted something which has the
permissions (owner, group, mode) recorded on the mounted something. The
permissions of the mount point directory prior to mounting the device
don't matter here at all.