You are not logged in.

#1 2021-11-13 10:35:31

Mutley
Member
Registered: 2021-11-13
Posts: 2

[Solved] Manually mounted USB Stick always ReadOnly no non-root user

Hi,

I am trying to mount a FAT32 formatted USB stick to a specific mountpoint (/mnt/usb) and have it writable by all users, however it always seems to end up read only (to non-root users) when i use the mount command. I can get it to work using udisksctl (mounted to /run/media/..) but not when i use the mount command to /mnt/usb. I've tried to include as much info as i can (see below), any help would be much appreciated. Thanks in advance.

All of the commands below were run as a non-root user.

This works:-

$ udisksctl mount --block-device /dev/sdc1
Mounted /dev/sdc1 at /run/media/dev/KIOXIA
$ touch /run/media/dev/KIOXIA/fred
$ ls /run/media/dev/KIOXIA
fred

With this method the USB Drive is only writable as root:-

$ ls -al /mnt
total 12
drwxr-xr-x  3 root root 4096 Nov 13 09:57 .
drwxr-xr-x 19 root root 4096 Aug 20 16:04 ..
drwxr-xr-x  2 root root 4096 Nov 13 09:56 usb

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 223.6G  0 disk 
├─sda1   8:1    0   512M  0 part /efi
└─sda2   8:2    0 223.1G  0 part /
sdb      8:16   0 223.6G  0 disk 
sdc      8:32   1  14.4G  0 disk 
└─sdc1   8:33   1  14.4G  0 part 

$ fdisk -l /dev/sdc
fdisk: cannot open /dev/sdc: Permission denied
[dev@hpz230 ~]$ sudo fdisk -l /dev/sdc
Disk /dev/sdc: 14.44 GiB, 15500574720 bytes, 30274560 sectors
Disk model: TransMemory     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0e3804ab

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1  *       63 30274271 30274209 14.4G  b W95 FAT32

$ sudo hdparm /dev/sdc

/dev/sdc:
 multcount     =  0 (off)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 14782/64/32, sectors = 30274560, start = 0

$ sudo mount -o gid=users,fmask=113,dmask=002 /dev/sdc1 /mnt/usb

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 223.6G  0 disk 
├─sda1   8:1    0   512M  0 part /efi
└─sda2   8:2    0 223.1G  0 part /
sdb      8:16   0 223.6G  0 disk 
sdc      8:32   1  14.4G  0 disk 
└─sdc1   8:33   1  14.4G  0 part /mnt/usb

$ touch /mnt/usb/fred
touch: cannot touch '/mnt/usb/fred': Permission denied

$ sudo touch /mnt/usb/fred

$ ls /mnt/usb
fred

Last edited by Mutley (2021-11-14 11:07:05)

Offline

#2 2021-11-13 14:39:14

dakota
Member
Registered: 2016-05-20
Posts: 417

Re: [Solved] Manually mounted USB Stick always ReadOnly no non-root user

Have you added fred to the users group?


"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb

Offline

#3 2021-11-13 22:05:58

Mutley
Member
Registered: 2021-11-13
Posts: 2

Re: [Solved] Manually mounted USB Stick always ReadOnly no non-root user

Embarrassingly no i did not! thanks for pointing out what should have been obvious ... all working fine now.

Offline

#4 2021-11-14 01:25:18

dakota
Member
Registered: 2016-05-20
Posts: 417

Re: [Solved] Manually mounted USB Stick always ReadOnly no non-root user

Glad I could help! smile

Please edit your first post by prepending [Solved] to the title, so others will know this issue has been resolved.

Cheers,


"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb

Offline

Board footer

Powered by FluxBB