USB pendrive mounts with root privs.

New to Debian (Or Linux in general)? Ask your questions here!

USB pendrive mounts with root privs.

Postby g6b0r » 2020-09-26 19:19

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!
g6b0r
 
Posts: 11
Joined: 2011-04-10 08:39

Re: USB pendrive mounts with root privs.

Postby Head_on_a_Stick » 2020-09-27 07:44

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.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12650
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: USB pendrive mounts with root privs.

Postby Dai_trying » 2020-09-27 07:45

Code: Select all
sudo chown fatter:fatter /media/fatter/KINGSTON
Dai_trying
 
Posts: 943
Joined: 2016-01-07 12:25

Re: USB pendrive mounts with root privs.

Postby g6b0r » 2020-09-27 08:30

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.

Postby g6b0r » 2020-09-27 08:32

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.
g6b0r
 
Posts: 11
Joined: 2011-04-10 08:39

Re: USB pendrive mounts with root privs.

Postby Head_on_a_Stick » 2020-09-27 11:42

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.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12650
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: USB pendrive mounts with root privs.

Postby cds60601 » 2020-09-27 15:02

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.
Server: Debian 10, Workstation: Debian Sid (BSPWM)
Laptop: Debian Sid (BSPWM)
----------------------------------------------------------------------------------
Don't Break Debian: https://wiki.debian.org/DontBreakDebian
User avatar
cds60601
 
Posts: 199
Joined: 2017-11-25 05:58
Location: Tampa, Florida

Re: USB pendrive mounts with root privs.

Postby g6b0r » 2020-09-27 18:05

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?
g6b0r
 
Posts: 11
Joined: 2011-04-10 08:39


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable