0

In for example Thunar I can just click on an external USB drive to mount it under /run/media/$USER/[something]. The fact that the mount point is created dynamically is a great side effect. But for any drives which are on the SATA bus I'm told

mount: only root can do that

or

Not authorized to perform operation.

How do I configure internal drives to work like USB drives in this respect?

3

I found a workaround for mounting devices as a user. A static line in /etc/fstab permits to mount/umount without being root :

/dev/sdc1 /mnt/sdc1 auto defaults,user,rw,utf8,noauto,umask=000 0 2

If /dev/sdc1 device & /mnt/sdc1 directory both exist, running either mount /dev/sdc1 or mount /mnt/sdc1 will mount the device on the directory.

Note that this workaround is valid for any GNU/Linux distribution.

Adding the following to the /etc/nixos/configuration.nix will generate the above /etc/fstab-line for NixOS :

  fileSystems."/mnt/sdc1" = {
    device = "/dev/sdc1";
    fsType = "auto";
    options = [ "defaults" "user" "rw" "utf8" "noauto" "umask=000" ];
  };
2

I don't think you can mount internal devices as a normal user in Linux.

I had a similar problem, wanting to make an internal disk available to a normal user in NixOS. The answer How to auto mount / permanently mount external devices on NixOS explains how to do auto mounting by mounting manually as a superuser, and running nixos-generate-config and nixos-rebuild switch.

Then using chown user:group /my-mount-point I was able to permanently configure the disk to be available to my user. Hope it helps.

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.