PDA

View Full Version : [xubuntu] Can not browse external drives with Thunar



bsh
April 9th, 2020, 04:46 PM
Hi,
on Xubuntu 18.04.4 desktop, whenever I plug in an external USB disk (thumbdrive/pendrive or hard disk or anything), it's icon appears on the desktop and it appears as it was mounted (and it is), but also a "Select which application to use to open this" window pops up (sorry I don't even know what it's officially called, because mine is hungarian), and no matter what I choose (obviously thunar), it does not work. And when I double click the icon on the desktop to open it, the same "Select application" pops up.
The drive gets mounted under /media/username, I can browse that from the command line as root, but not as a normal user, so I think it is somehow a permission issue. Permissions are:
755 root:root /media
750 root:root /media/username
755 username:usergroup /media/username/drivelabel

It doesn't matter if the drive has a single partition or multiple, what filesystems are on it, etc. FAT, ext4, nothing works.

Any help please? Thanks.

ajgreeny
April 9th, 2020, 07:56 PM
With one of those disks attached that has files on it can you please run command
sudo ls -la /media/username/label so we can see permissions of files and folders it contains.
Use the proper username and label, of course.
Also please show the output of command
mount
You ought to be able to both read and write to a disk formatted as fat32 or NTFS, so the more info we can get the better.

bsh
April 10th, 2020, 08:10 AM
Sorry, I'm not going to be around that computer* during the holidays. (Til tuesday)

I've tested with a 8 gig Sandisk (which is also the partition label) freshly formatted FAT3 thumbdrive, with nothing on it, permissions see above.

* IIRC I've seen this exact same behaviour on all of my xubuntu installs, gotta check.

Artim
April 10th, 2020, 09:34 PM
Try opening Thunar as root:


sudo thunar

ajgreeny
April 12th, 2020, 08:47 AM
Try opening Thunar as root:


sudo thunar
No, no, no!!

Please never do that or you may end up with even bigger problems; not being able to login as user is one possible result of starting thunar with sudo.

If you feel you must open thunar as root use "sudo -H thunar" instead.

Artim
April 12th, 2020, 12:28 PM
I stand corrected! Tell me, please, what is the difference between sudo and sudo -H?

CelticWarrior
April 12th, 2020, 01:13 PM
From man sudo:


-H, --set-home
Request that the security policy set the HOME environment
variable to the home directory specified by the target user's
password database entry. Depending on the policy, this may
be the default behavior.

The Cog
April 12th, 2020, 01:54 PM
To expand on that: Setting the home directory to root's prevents thunar from placing root-owned files in your directory that you cannot then read. Without that -H precaution, many apps that you run with sudo can create history or configuration files that you as a user cannot read, which prevents you from using the app again without using sudo.

Personally, I use "sudo -i" by habit rather than "sudo -H", but I think that difference is minor.

Morbius1
April 12th, 2020, 03:29 PM
Unless you are running Ubuntu 20.04:

Ubuntu 18.04

tester@ub1804:~$ printenv | grep HOME
HOME=/home/tester
tester@ub1804:~$ sudo printenv | grep HOME
[sudo] password for tester:
HOME=/home/tester

Ubuntu 20.04:

tester@ub2004:~$ printenv | grep HOME
HOME=/home/tester
tester@ub2004:~$ sudo printenv | grep HOME
[sudo] password for tester:
HOME=/root

So it will basically default to the -H option to make sure it runs with HOME of the user being invoked ( root in this case ) not the user doing the invoking.

The Cog
April 13th, 2020, 09:50 AM
Ooh! There's interesting.
I just tried, and it also changes home on 19.10. That's a very good idea. I'll try it on Red Hat tomorrow to see what that does.

ajgreeny
April 13th, 2020, 10:59 AM
Unless you are running Ubuntu 20.04:

Ubuntu 18.04

tester@ub1804:~$ printenv | grep HOME
HOME=/home/tester
tester@ub1804:~$ sudo printenv | grep HOME
[sudo] password for tester:
HOME=/home/tester

Ubuntu 20.04:

tester@ub2004:~$ printenv | grep HOME
HOME=/home/tester
tester@ub2004:~$ sudo printenv | grep HOME
[sudo] password for tester:
HOME=/root

So it will basically default to the -H option to make sure it runs with HOME of the user being invoked ( root in this case ) not the user doing the invoking.
So forgive me for asking what to you may seem obvious, but does that mean that using sudo for a GUI application in 20.04, and maybe 19.10, will not, or should not cause the permissions problems that it can potentially in earlier versions of Ubuntu?

That's how your post reads to me.

Morbius1
April 13th, 2020, 10:15 PM
You are correct. The change restores sudo handling of $HOME to what everyone else does (https://launchpad.net/ubuntu/eoan/+source/sudo/+changelog)

See also: https://askubuntu.com/questions/1186999/how-does-sudo-handle-home-differently-since-19-10

DuckHook
April 14th, 2020, 04:06 AM
You've no idea how long I (and presumably the 'buntu world out there) have been waiting/pining for this reversion to sanity. Why on earth was it ever changed in the first place???

bsh
April 14th, 2020, 01:07 PM
ok so after this derail:
i think i solved it. i just deleted everything from /media and let the system recreate the mount folders when a device was connected. it turns out, the username folder under /media had wrong permissions.
media looks like this and it was ok:
drwxr-xr-x 3 root root 4096 ápr 14 13:56 media

the contents of media:
drwxr-xr-x 3 root root 4096 ápr 14 13:56 .
drwxr-xr-x 25 root root 4096 ápr 7 06:27 ..
drwxr-x---+ 3 root root 4096 ápr 14 13:56 username
this was 755 before and without the +

and finally the contents of /media/username when a SANDISK drive is connected:
drwxr-x---+ 3 root root 4096 ápr 14 13:56 .
drwxr-xr-x 3 root root 4096 ápr 14 13:56 ..
drwxr-xr-x 2 username username 4096 ápr 14 13:56 SANDISK

this now opens as usual, without the "select application to open this unknown file" thingy, and is read/write.
maybe the /media folder and it's contents were wrong because it may be a remains of older installs.

ajgreeny
April 14th, 2020, 10:36 PM
Great news!

Please mark as SOLVED from the Thread Tools menu up-top if this really is now solved to your satisfaction. It is a great help to other users searching the forum.