[Swlug] Automounting problem

Colin Law clanlaw at gmail.com
Sat May 28 10:45:12 UTC 2016


On 28 May 2016 at 10:54, Mark Summerfield <mark at qtrac.eu> wrote:
> Hi Colin,
>
> On Sat, 28 May 2016 09:17:54 +0100
> Colin Law <clanlaw at gmail.com> wrote:
>> On 28 May 2016 at 07:49, Mark Summerfield via Swlug
>> <swlug at mailman.lug.org.uk> wrote:
>> > Hi,
>> >
>> > I have a strange automounting problem.
>> >
>> > I have a machine with two user accounts: mark & andreas (the second
>> > created by mistake - should have been andrea).
>> >
>> > I have no USB devices in /etc/fstab
>> >
>> > When I insert an ext4-formatted USB memory stick it is mounted in
>> > /media/mark/VolumeNameOfMemoryStick
>> >
>> > But ls -lh on it reveals it its owner and group are andreas andreas. So
>> > although I can read it, the only way to write is to sudo -u andreas -i
>> > and then do it from that account.
>>
>> I assume the files on the stick were initially created by andreas.
>
> No, they were all created on a different computer by mark.
>
>> If
>> you run something like
>> sudo chown -R mark:mark /media/mark/VolumeNameOfMemoryStick
>> then it will change them all to you.
>
> All the files on it are already mark.mark when viewed on the original
> computer. But when viewed on the other computer then it sees them as
> andreas.andreas -- which is the problem. So it isn't what's on the
> memory stick that's at fault but how Xubuntu _sees_ it.

Ah, you did not tell us that.  As Huw suggests this means that the
user ids on the two machines do not match.  On the machine with the
andreas user that user probably has the uid 1000 and the mark user has
the uid 1001.  You can check that by running
id -u mark
id -u andreas

You want to have the uid for mark as 1000.  I suggest first changing
the uid of andreas to 1002 (to free up 1000).  Logon as mark then
sudo usermod -u 1002 andreas
sudo groupmod -u -1002 andreas
The above automatically changes the uid (but not gid on home directory
files, but to find any others and to change group ids on files
sudo find / -uid 1000 -exec sudo chown -h 1002 {} +
sudo find / -gid 1000 -exec sudo chgrp -h 1002 {} +

Then logon as andreas and change the uid for mark to 1000
sudo usermod -u 1000 mark
sudo groupmod -u 1000 mark
and again, to correct ids
sudo find / -uid 1001 -exec sudo chown -h 1000 {} +
sudo find / -gid 1001 -exec sudo chgrp -h 1000 {} +

Do make sure you have everything backed up first in case of problems doing this.

To have avoided the problem in the first place you could have changed
the name of the user andreas to mark rather than adding a new user.

Colin



More information about the Swlug mailing list