Automount file permissions

Please post all general support questions for LXDE here.
Locked
cefn
Posts: 4
Joined: Fri Mar 09, 2012 5:49 pm

Automount file permissions

Post by cefn »

I have found myself in a situation where I am not permitted to read automounted filesystems and I can't fathom why. I recently changed the uid and gid of my user account (username=cefn) from 1001:1001 to 1000:1000 which might be related, but since then I have also run the following to change all files which were previously owned by 1001 to be swapped to 1000...

Code: Select all

sudo find / -user 1001 -exec chown -h cefn {} \;
sudo find / -group 1001 -exec chgrp -h cefn {} \;
For example in PCManFM there is a partition mounted from an SD Card named 'fat32', but clicking on it triggers a dialog

Code: Select all

The specified directory '/media/cefn/fat32' is not valid
or if I try to ls it...

Code: Select all

ls -la /media/cefn/fat32/
ls: cannot access '/media/cefn/fat32/': Permission denied
cefn@cefn-xenial-toshiba:~$ ls -la /media/cefn/fat32/Sky
ls: cannot access '/media/cefn/fat32/Sky': Permission denied
But the filesystems seem to have the right sort of visibility if I run with sudo...

Code: Select all

sudo ls -la /media/cefn/
total 24
drwxr-x---+ 5 root root 4096 Jan  1 13:29 .
drwxr-xr-x  4 root root 4096 Jan  1 11:58 ..
drwxr-xr-x  9 root root 4096 Dec 31 17:28 96e93dc8-b388-482e-bab1-1ac4a7ce35e4
drwxr-xr-x  4 cefn cefn 8192 Jan  1  1970 fat32
drwxr-xr-x  3 root root 4096 Dec 30 00:35 lubuntu-root
Any thoughts how I can get back to a normal situation where I can read automounted filesystems again? Where is the failure happening?
drooly
Posts: 791
Joined: Mon Apr 08, 2013 6:45 am

Re: Automount file permissions

Post by drooly »

well it sounds like you messed up your permissions pretty well.
every command that starts with sudo and contains '/' should be treated with the utmost respect.
and should be executed only when 100% sure what it does.

so much from mr hindsight.

save your data (i guess you canstill access it with root privileges?) and reinstall.
cefn
Posts: 4
Joined: Fri Mar 09, 2012 5:49 pm

Re: Automount file permissions

Post by cefn »

Turned out to be fixed after launching a 'repair' session from Grub, choosing a root shell and removing the /media/cefn directory (and whatever broken cruft and permissions were there).

After re-logging in as cefn the /media/cefn folder was re-created and no longer broken. The weird thing was being unable to identify what was different with the new one. It now looks like the below which looks entirely identical...

Code: Select all

sudo ls -la /media/cefn/
total 24
drwxr-x---+ 5 root root 4096 Jan  2 01:54 .
drwxr-xr-x  4 root root 4096 Jan  1 14:09 ..
drwxr-xr-x  9 root root 4096 Dec 31 17:28 96e93dc8-b388-482e-bab1-1ac4a7ce35e4
drwxr-xr-x  4 cefn cefn 8192 Jan  1  1970 fat32
drwxr-xr-x  3 root root 4096 Dec 30 00:35 lubuntu-root
Locked