3

I use pmount to mount USBs as normal user. But how can I use pmount so I can write to the device too, instead of just read from it? I tried pmount -w /dev/sdb1 but it doesn't work, /media/sdb1 is still unwritable by anyone except by root. Filesystem of USB partition is ext4.

  • Nevermind, I'll just use NTFS. – Hanlon Dec 30 '17 at 20:23
4

I think -w affects mount option (like in mount -o rw …). File and directory permissions and ownership are something completely different. You can be experiencing this: Different UID/GID when using an ext4 formatted USB drive with another computer.

If root user can write to the filesystem, then it is mounted as writable, so -w does in fact work. The rest is just an ownership issue. You can "fix" it with chown (if you have sudo access etc.). Later on another OS you may have the same problem due to UIDs/GIDs not matching between systems, as explained under the linked question.

| improve this answer | |
5

pmount will not alter the mounted filesystem's permissions - thus you'll need to use chown, chmod or similar approach (as root) to change the owner/group/permissions of the root (or other relevant point) of the filesystem.

For example:

$ ls -dn mnt
drwxr-xr-x 3 0 0 1024 Dec 30 18:36 mnt
$ touch mnt/test
touch: cannot touch 'mnt/test': Permission denied
$ sudo chown $(id -nu): ./mnt
$ ls -dn mnt
drwxr-xr-x 3 1000 1000 1024 Dec 30 18:34 mnt
$ touch mnt/test
$ ls -ln mnt
total 12
drwx------ 2    0    0 12288 Dec 30 18:34 lost+found
-rw------- 1 1000 1000     0 Dec 30 18:36 test

This will persist across mounts... but be careful as the numeric UID/GID will need to line up on all systems that you use the filesystem on.

| improve this answer | |
  • Is it possible to mount system as writable by user without root privileges? – Hanlon Dec 30 '17 at 19:31
  • That is a broken question. You need to change the root (or a subdirectory) of the filesystem such that your user has permission to write to it. – Attie Dec 30 '17 at 20:26
  • @Vuk Read: Possible to mount an ext4 partition image via FUSE? If you use NTFS, you will use FUSE as well. – Kamil Maciorowski Dec 30 '17 at 20:26
  • If you're open to alternative filesystems, try NTFS / exFAT / FAT, and use the -o uid=$(id -u),gid=$(id -g) options. – Attie Dec 30 '17 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.