I have an internal 8tb harddrive which I want it to be mounted to all users on my machine some of the users are local and some are ldap users.

I've created a folder called 8tb in /media/8tb

Then I added the below to /etc/fstab

/dev/sda /media/8tb ext4 user,defaults 0 1

Now I wonder how to make this drive mounted to all users?

  • What do you mean by "mounted to all users"? – Henrik Apr 26 at 13:54
  • @Henrik I mean when any user (local or ldap) logins they have this drive mounted. – Tak Apr 26 at 13:55
  • man mount: users Allow any user to mount and to unmount the filesystem. – Biswapriyo Apr 26 at 13:57
  • Can it be mounted when no user is logged in? Then just remove the user option from the line in /etc/fstab. Otherwise you should change user to users, and add something to the login processes (where to do so depends on how your users log in, but you also have to hook into something that also allows you to hook into the logout process) that does the (un)mounting - and if you need to support several users logged in at the same time, some extra bookkeeping is needed. – Henrik Apr 26 at 14:15
  • @Henrik thank you. Now the drive is mounted automatically to all users. One problem now is that I have a program installed on this drive but when I try to run it from any user even admins it gives bash: /media/8tb/myprogramfolder/myprogram : Permission denied Any advice? – Tak Apr 26 at 14:31

Now I wonder how to make this drive mounted to all users?

Speaking of any storage media, having it "mounted for all users" is misleading : a media is mounted on the system, OR is not mounted on the system. Whether it is accessible to none / some / all users is a different question.

So, as long as your 8TB drive is mounted, it is mounted for the operating system, and it will be there when users log in. Now, it's up to this operating system (and you), to grant access permissions to users. To do so, investigate Linux filesystem permissions (users, groups, and the like).

NB : you probably won't need that "users" directive in /etc/fstab

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.