M
M
madved2017-03-21 23:23:49
linux
madved, 2017-03-21 23:23:49

How to mount an ext4 disk for multiple users?

Hello, there was a problem - I mounted an ext4 disk via fstab to the home directories of each user with default settings like this:

UUID=diskuid /home/user1/folder ext4 defaults        0       2
UUID=diskuid /home/user2/folder ext4 defaults        0       2

The problem is that when you overwrite a file under one user, the rights to the file are closed for another user. How to mount a disk so that the rights to the file do not change. Now I have to recursively apply chmod 777. It's just that I don't fully understand all these mount options. The location in media or in mnt would also be avoided. All this on one machine and on one system.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mureevms, 2017-03-22
@mureevms

1. Add mask to mount options

UUID=diskuid /home/user1/folder ext4  umask=0002     0       2
UUID=diskuid /home/user2/folder ext4  umask=0002     0       2

Thus, the rights of the user and the group will be the same - 775 for directories and 664 for files.
2. Create a group and put both users there
3. Give this group rights to the directory
chown :newgroup /home/user1/folder -R

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question