External drive is being mounted as read-only

Ed Greshko ed.greshko at greshko.com
Mon Sep 1 07:40:07 UTC 2014


On 09/01/14 15:30, Sudhir Khanger wrote:
> Yes, the disk is being mounted as RW but not as a regular user.
>
> On your system when mounting ext4 usb-storage through a graphical file
> manager like Dolphin or Nautilus is it mounted under root:root user?

The disk gets mounted with permissions and ownership as stored in the file system when using ext4.  That is the way the filesystem works.

The command that I gave you "sudo chmod 1777 /run/media/donnie/storejet" will make the filesystem be the same as /tmp.

[root at meimei ~]# ll -d /tmp
drwxrwxrwt. 16 root root 440 Sep  1 15:12 /tmp

This allows anyone to write to the file system and since the sticky bit is set (t) only allows the owner of the file to delete it.

Now, if you want the file system to be mounted as a given user you can use the chown command.

As an example.....

[root at meimei ~]# grep maria /etc/passwd
maria:x:1003:1003:Maria Yang:/home/maria:/bin/bash

[root at meimei ~]# ll -d /run/media/egreshko/ext
drwxr-xr-x. 3 maria maria 4096 Sep  1 06:29 /run/media/egreshko/ext

Now, every time that partition is mounted it will be mounted as owned by maria and group maria.  The downside with that is if you have system where the UID/GID aren't 1003.

-- 
If you can't laugh at yourself, others will gladly oblige.



More information about the users mailing list