Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
30
rated 0 times [  30] [ 0]  / answers: 1 / hits: 54277  / 2 Years ago, wed, december 22, 2021, 8:41:59

I am trying to use my ext4 USB drive but Ubuntu 13 is currently mounting it with write permission only for root so with my normal user I can't write to it, without sudo.



The first place I checked was dconf-editor which has the following options




  • automount

  • automount-open

  • autorun-never

  • autorun-x-content-ignore

  • autorun-x-content-open-folder

  • autorun-x-content-start-app



and it seems to me there should be an option in there to control if I can write to the mounted USB drive, but no.



I also made sure my user is in the relevant groups: fuse and plugdev



I've searched most of the internet and can't find a solution to change the permissions given by the mount operation. There's literally nobody out there having this problem incredibly. A ton of people have issues because their drives mounts totally read-only, but not this way with only root write permission.



I can't see any way of controlling what happens. I looked at setting the mount options using gnome-disks but drew a blank.



It's not in fstab but it does appear in the mount list or /etc/mtab:



/dev/sdb1 /media/adam/WDPassport2T ext4 rw,nosuid,nodev,uhelper=udisks2 0 0


This is what appears in syslog if it helps:



kernel: [111522.196770] usb 2-1: USB disconnect, device number 6
kernel: [111525.384020] usb 2-1: new high-speed USB device number 7 using ehci-pci
kernel: [111525.565220] usb 2-1: New USB device found, idVendor=1058, idProduct=0820
kernel: [111525.565225] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=5
kernel: [111525.565227] usb 2-1: Product: My Passport 0820
kernel: [111525.565229] usb 2-1: Manufacturer: Western Digital
kernel: [111525.565231] usb 2-1: SerialNumber: 575832314141334A34383631
kernel: [111525.565729] usb-storage 2-1:1.0: USB Mass Storage device detected
kernel: [111525.566203] scsi9 : usb-storage 2-1:1.0
mtp-probe: checking bus 2, device 7: "/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1"
mtp-probe: bus: 2, device: 7 was not an MTP device
kernel: [111526.564697] scsi 9:0:0:0: Direct-Access WD My Passport 0820 1007 PQ: 0 ANSI: 6
kernel: [111526.565063] scsi 9:0:0:1: Enclosure WD SES Device 1007 PQ: 0 ANSI: 6
kernel: [111526.568096] sd 9:0:0:0: Attached scsi generic sg2 type 0
kernel: [111526.568202] ses 9:0:0:1: Attached Enclosure device
kernel: [111526.568263] ses 9:0:0:1: Attached scsi generic sg3 type 13
kernel: [111531.263108] sd 9:0:0:0: [sdb] 3906963456 512-byte logical blocks: (2.00 TB/1.81 TiB)
kernel: [111531.265100] sd 9:0:0:0: [sdb] Write Protect is off
kernel: [111531.265105] sd 9:0:0:0: [sdb] Mode Sense: 47 00 10 08
kernel: [111531.266473] sd 9:0:0:0: [sdb] No Caching mode page found
kernel: [111531.266479] sd 9:0:0:0: [sdb] Assuming drive cache: write through
kernel: [111531.272224] sd 9:0:0:0: [sdb] No Caching mode page found
kernel: [111531.272230] sd 9:0:0:0: [sdb] Assuming drive cache: write through
kernel: [111531.284885] sdb: sdb1
kernel: [111531.288219] sd 9:0:0:0: [sdb] No Caching mode page found
kernel: [111531.288223] sd 9:0:0:0: [sdb] Assuming drive cache: write through
kernel: [111531.288227] sd 9:0:0:0: [sdb] Attached SCSI disk
kernel: [111531.751588] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)
udisksd[3131]: Mounted /dev/sdb1 at /media/adam/WDPassport2T on behalf of uid 1000

More From » unity

 Answers
4

A possible reason could be that you formatted/created the storage disk with a tool with root privilege and so the file-system created was owned by the root.


Let's have a look at the o/p of your ls commands:


$ ls -ld /media/adam/WDPassport2T
drwxr-xr-x 4 root root 4096 Jan 15 16:57 /media/adam/WDPassport2T
$ ls -l /media/adam/WDPassport2T
total 20
drwxr-xr-x 2 root root 4096 Jan 15 16:57 backuppc
drwx------ 2 root root 16384 Jan 15 15:37 lost+found

The file-system is owned by the root, as indicated by ls -ld for your mount WDPassport2T and the permission string drwxr-xr-x shows the owner root has the RW permissions while, the members of group root along with the world/others will only have R-permission.


To solve you could change the permissions with chmod or just change the ownership recursively, and this is what I've shown below:


sudo chown <username>:<groupname> -R /path/to/target

which in your case would be:


sudo chown adam:adam -R /media/adam/WDPassport2T/

Now if you need, you may also set the permissions with chmod:


find /media/adam/WDPassport2T/ -type f -execdir chmod 666 -Rv {} +

(which gives owner, group and the world RW permissions for all the files in the target.)


find /media/adam/WDPassport2T/ -type d -execdir chmod 777 -Rv {} +

(which gives owner, group and the world RWX permissions for all the directories in the target.)


Reference:


Official Ubuntu Documentation: File Permissions


[#27458] Thursday, December 23, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
feeous

Total Points: 102
Total Questions: 122
Total Answers: 119

Location: Netherlands
Member since Thu, Jul 1, 2021
3 Years ago
feeous questions
Sat, Jul 23, 22, 23:21, 2 Years ago
Mon, Jul 5, 21, 19:59, 3 Years ago
Mon, Aug 16, 21, 11:42, 3 Years ago
Sun, Mar 19, 23, 21:03, 1 Year ago
;