LinuxIndya | Home | Blog

Mount a drive with proper file permissions

When you mount a drive in linux then you have to use sudo which is fine but the mount owner is root and does't have the right permissions for a normal user.

So specify the user and group.

sudo mount -o gid=1000,uid=1000 /dev/mmcblk0p1 /srv/public/sdcard1_4gb/

You can then change the permissions as well of that mount. This can also be done with umask=0777 but it doesn't work for ext file system, so change do chmod on the mount.

chmod 777 /sdcard1_4gb

In case you are wondering how to get the gid and uid then use the id command.

Cool right?