Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

USB pendrive mounts with root privs.

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
g6b0r
Posts: 11
Joined: 2011-04-10 08:39

USB pendrive mounts with root privs.

#1 Post by g6b0r »

hi,

I have a debian 9.11 runing on an old laptop. I am using Xfce as the machine ~10 yrs old.
Can someone please help me to figure out why do I have the USB drives mounted automatically with root privileges, so the ordinary user which is logged in can't write it?
There is this thunar filemanager with Xfce but I could not really find out what causes this to behave as it is.
There is usbmount installed but it seems to have some issue based on syslog:

Code: Select all

Sep 26 21:47:03 t400 kernel: [  561.408059] usb 1-1: new high-speed USB device number 5 using ehci-pci
Sep 26 21:47:03 t400 kernel: [  561.569568] usb 1-1: New USB device found, idVendor=0951, idProduct=1666
Sep 26 21:47:03 t400 kernel: [  561.569574] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Sep 26 21:47:03 t400 kernel: [  561.569578] usb 1-1: Product: DataTraveler 3.0
Sep 26 21:47:03 t400 kernel: [  561.569581] usb 1-1: Manufacturer: Kingston
Sep 26 21:47:03 t400 kernel: [  561.569585] usb 1-1: SerialNumber: D067E51599A7F471260848F4
Sep 26 21:47:03 t400 kernel: [  561.577874] usb-storage 1-1:1.0: USB Mass Storage device detected
Sep 26 21:47:03 t400 kernel: [  561.578097] scsi host4: usb-storage 1-1:1.0
Sep 26 21:47:03 t400 mtp-probe: checking bus 1, device 5: "/sys/devices/pci0000:00/0000:00:1a.7/usb1/1-1"
Sep 26 21:47:03 t400 mtp-probe: bus: 1, device: 5 was not an MTP device
Sep 26 21:47:04 t400 kernel: [  562.589422] scsi 4:0:0:0: Direct-Access     Kingston DataTraveler 3.0      PQ: 0 ANSI: 6
Sep 26 21:47:04 t400 kernel: [  562.591110] sd 4:0:0:0: [sdb] 60437492 512-byte logical blocks: (30.9 GB/28.8 GiB)
Sep 26 21:47:04 t400 kernel: [  562.591725] sd 4:0:0:0: [sdb] Write Protect is off
Sep 26 21:47:04 t400 kernel: [  562.591731] sd 4:0:0:0: [sdb] Mode Sense: 4f 00 00 00
Sep 26 21:47:04 t400 kernel: [  562.591869] sd 4:0:0:0: Attached scsi generic sg2 type 0
Sep 26 21:47:04 t400 kernel: [  562.592478] sd 4:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Sep 26 21:47:04 t400 kernel: [  562.600093]  sdb: sdb1
Sep 26 21:47:04 t400 kernel: [  562.602452] sd 4:0:0:0: [sdb] Attached SCSI removable disk
Sep 26 21:47:05 t400 usbmount[1679]: /dev/sdb does not contain a filesystem or disklabel
Sep 26 21:47:05 t400 systemd-udevd[1673]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Sep 26 21:47:05 t400 usbmount[1699]: executing command: mount -tvfat -osync,noexec,nodev,noatime,nodiratime /dev/sdb1 /media/usb0
Sep 26 21:47:05 t400 kernel: [  562.820397] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Sep 26 21:47:05 t400 usbmount[1699]: executing command: run-parts /etc/usbmount/mount.d
Sep 26 21:47:10 t400 kernel: [  568.148137] [UFW BLOCK] IN=wlan0 OUT= MAC=00:21:6a:a6:ba:ea:0c:80:63:01:0f:53:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=36 TOS=0x00 PREC=0x00 TTL=1 ID=0 DF PROTO=2 
Sep 26 21:47:37 t400 udisksd[1141]: Mounted /dev/sdb1 at /media/fatter/KINGSTON on behalf of uid 1000
I was fiddling with dir ownership but the KINGSTON dir is created always with root privs:

Code: Select all

fatter@t400:~$ ls -alF /media/fatter/
total 28
drwxrwxrwx+  4 fatter fatter  4096 Sep 26 22:04 ./
drwxr-xr-x  13 root   root    4096 Sep 26 17:51 ../
drwxr-xr-x   2 root   root   16384 Jan  1  1970 KINGSTON/
drwxr-xr-x   2 fatter fatter  4096 Sep 26 18:47 prb/
fatter@t400:~$ 
Any hints would be appreciated!

cheers!

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: USB pendrive mounts with root privs.

#2 Post by Head_on_a_Stick »

g6b0r wrote:There is usbmount installed
Why? That package was removed for the stretch release. Uninstall it.

For thunar use GVFS to automount USB sticks.
g6b0r wrote:I was fiddling with dir ownership
Don't do that.
deadbang

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: USB pendrive mounts with root privs.

#3 Post by Dai_trying »

Code: Select all

sudo chown fatter:fatter /media/fatter/KINGSTON

g6b0r
Posts: 11
Joined: 2011-04-10 08:39

Re: USB pendrive mounts with root privs.

#4 Post by g6b0r »

thanks!
Head_on_a_Stick wrote:
g6b0r wrote:There is usbmount installed
Why? That package was removed for the stretch release. Uninstall it.

For thunar use GVFS to automount USB sticks.
g6b0r wrote:I was fiddling with dir ownership
Don't do that.
I was trying some "seems to be obvious things" as it was not working....
But ok, I will remove.
But do you have some idea or some documentation I can check to make it properly work (so, the USB would be mounted with user accessible permissions)?
Last edited by g6b0r on 2020-09-27 08:34, edited 1 time in total.

g6b0r
Posts: 11
Joined: 2011-04-10 08:39

Re: USB pendrive mounts with root privs.

#5 Post by g6b0r »

thanks!
Dai_trying wrote:

Code: Select all

sudo chown fatter:fatter /media/fatter/KINGSTON
Actaually the /media/fatter/ dir has the same ownership as you indicated.
But how it can be done 'automagically'? As this /KINGSTON dir is an ephemeral directory created when the USB mounted.
So, I don't want to every time manually fiddle around - just plug that stick and write on it.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: USB pendrive mounts with root privs.

#6 Post by Head_on_a_Stick »

g6b0r wrote:do you have some idea or some documentation I can check to make it properly work (so, the USB would be mounted with user accessible permissions)?
Install https://packages.debian.org/buster/gvfs-backends and read https://docs.xfce.org/xfce/thunar/using-removable-media.
deadbang

User avatar
cds60601
df -h | participant
df -h | participant
Posts: 706
Joined: 2017-11-25 05:58
Location: Florida
Has thanked: 129 times
Been thanked: 60 times

Re: USB pendrive mounts with root privs.

#7 Post by cds60601 »

Head_on_a_Stick wrote:
g6b0r wrote:There is usbmount installed
Why? That package was removed for the stretch release. Uninstall it.

For thunar use GVFS to automount USB sticks.
g6b0r wrote:I was fiddling with dir ownership
Don't do that.
It appears that the bug reporting stopped in 2016 and still is marked as grave. It's too bad as it looks like it would be ideal for many that use a leaner DE or WM.
Supercalifragilisticexpialidocious

g6b0r
Posts: 11
Joined: 2011-04-10 08:39

Re: USB pendrive mounts with root privs.

#8 Post by g6b0r »

Head_on_a_Stick wrote:
g6b0r wrote:do you have some idea or some documentation I can check to make it properly work (so, the USB would be mounted with user accessible permissions)?
Install https://packages.debian.org/buster/gvfs-backends and read https://docs.xfce.org/xfce/thunar/using-removable-media.
thanks again.
Actually the gvfs-backends was installed already. But after I removed the usbmount the issue disappeared - so now it mounts usb with proper write access to the user.
I am thinking what changed this and one thing may be the thunar mount directory ownership. it was by owned by root so I manually changed earlier, just similarly as Dai_trying also recommended. But even after that it was not working as it should be.
Then also manually installed some packages that were mentioned across different forums where I read about similar issues. (these were ntfs-config, gvfs-bin and gvfs-fuse).
But finally it is working. Thanks for the helps! 8)
Do you know some more detailed - I mean kind of under the hood - description about this thunar?

Post Reply