sábado, 11 de junio de 2016

How to Make an Ext4 Filesystem with User Permissions

Formatting a partition or a pendrive as Ext4 is quite simple.  However, soon one realizes that it can only be used as root.

But a fellow Linux user named Dolphin Oracle shared these useful tricks on MX forums:

sudo mkfs.ext4 -E root_owner=$UID:$GID /dev/sdXY

where /dev/sdXY should be replaced with /dev/designation_of_partition.


The command above will set as user whoever issued the sudo command. You will still need to mount the device as root, but you may use its files as a regular user.

If you want something a bit different, he also shared this one:

mkfs.ext4 -E root_owner=uid:gid /dev/sdaX

where uid is the user id of whoever you want to be owner (the user created at install will have a UID of 1000).


where gid is the group id of whoever you want to be owner (the user-group created at install will have a GID of 1000).


If you want to mount the devices as a regular user instead of root, you'll have to do this:

paste the contents below into a file called /etc/polkit-1/localauthority/50-local.d/50-udisks.pkla

[udisks]
Identity=unix-group:users
Action=org.freedesktop.udisks*
ResultAny=yes
ResultInactive=no
ResultActive=yes


Reboot and then you should be able to mount the devices as a regular user.

2 comentarios: