Mounting external drive with read/write access

Hello everyone,

i have external HDD drive which is encrypted using luks and on top of it there is an ext4 file system. When I plugin the drive into USB, it normally asks for password and after it it mounts into

/run/media/xxx/f82479bb-070b-4e24-a775-857dc1579586

with permitions set to:

drwxr-xr-x 4 root root 12K Jul 30 09:14 f82479bb-070b-4e24-a775-857dc1579586

Now, i can't copy files on the drive without using terminal, which can be a little frustrating. :slight_smile:

More or less, if i put ext2,3,4, xfs, btrfs or something linux native, it will always mount with root as mount point owner. On the other hand, exfat or fat32 will mount with my user as mount point owner.

Now, is this expected behavior or something should be corrected to avoid this problem?

1 Like

If you want to avoid copying files using sudo in the terminal - you could change owner on the filesystem.

sudo chown $USER:$USER /run/media/xxx/f82479bb-070b-4e24-a775-857dc1579586 -R

Or you could change permission

sudo chmod 777 /run/media/xxx/f82479bb-070b-4e24-a775-857dc1579586 -R

You could also edit the filesystem to have an easier name

sudo e2label /dev/sdxY "my secret disk"
2 Likes

Thanks for your answer! That is fine solution but I would like to solve this permanently.

Probably, the most effective way will be to change FS to exfat.

No, just change file permissions to give your normal user read-write access. Or create a subdirectory owned by the user.

This is all pretty basic stuff - no need to use another filesystem.

I'm not sure if you understood the problem well. I don't have problem with my internal HDDs, they are configured well. This is an external drive. When i plug it in, manjaro creates new temporary mount point, with root as owner. When unplugged, mount point is automatically deleted. And that is only the case with ext4, xfs, btrfs or similar. For exfat and fat32 normal mount point with my user is created.

I did understand you well.

I have done it on several occasions.

Like internal disks you can change owner or permissions for an external drive.

I usually name the partition - and the mount point will use the partition name when mounting.

Since I am the only person using the driver, I usually change the owner to be my username:group combination.

On Manjaro a group with the users name is always created.

When I plugin the drive I have immediate access to it.

2 Likes

You could mount the drive in fstab with the "nofail" option which ensures your boot doesn't hang if the external drive isn't present. I do that with my external ext4 drives.

Rather than a chmod 777, I would suggest this to set the default Linux file and directory permissions.

sudo chmod -R u+rwX,go+rX,go-w /run/media/xxx/f82479bb-070b-4e24-a775-857dc1579586

chown your drive as @linux-aarhus suggested.

2 Likes

I can assure you I have. I have four external USB HDDs on my desk, two are ZFS-formatted, two are ext4. The ZFS pools require manual intervention to import and export, but apart from that will mount in their appropriate places with the file permissions I have set. The ext4 drives will mount in the "usual" places with the correct file permissions.

The only reason to use a FAT-based FS is if you want no file permissions control whatsoever, e.g. if you share the disk between a number of people and different OS.

2 Likes

Thanks!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by