[SOLVED] Write permission to every user in ext4 (fstab)
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I wanted to ask you one question. The thing is, I used to have 3 NTFS partitions which I've recently formatted into ext4 partitions. This are data partitions that are supposed to be read and written by every user (I have two users). The thing is that both users can read and write the partitions, but if user Carl creates a directory, user Lenny can't delete that directory, because that directory is owned by Carl. Of couse, as root I can change the permissions, but I don't want to do that every time.
When the partitions where NTFS, if either Carl or Lenny created a directory or file, the owner was immediately root, but both of them had all the permissions to modify things as they like. I wonder if there is something I can modify in /etc/fstab to make the partitions behave that way. I've read the mount man, but didn't find a solution.
This is working for me (for now). However there's something weird. If a user creates a dir, if you list the properties you can see that the group does not have writing permissions, but the other user can modify the dir (erase, rename, etc). The only thing that makes it not that crazy is the "s" flag:
drwxr-sr-x 2 lenny plugdev 4096 sep 11 13:35 New Directory
As you say, the umask= mount option doesn't work for ext filesystems, it's intended to be used in order to simulate permissions with non native filesystems like FAT that don't support the UNIX permissions system. What I was referring to is the 'umask' command (it's usually a shell builtin command, so if you look in the man page for bash you'll find a description, although a "man umask" will also provide some good background.
Setting a default umask is normally something that gets done in /etc/profile when you login.
As for the permissions not doing quite what you expect: it's best to think of it as the permissions controlling what you can do to the content of the thing the permissions are on. i.e.
The permissions on a file allow you to change the contents of a file, but file deletion and renaming are changes to a directory and not the file itself.
The permissions on a directory allow you to change the contents of the directory, i.e. what files are in it and their names.
If /dir1/file1 is read only, but /dir1 is read/write, then you won't be able to change the contents of file1 but you will be able to rename or delete file1! (However someone sneaky could cheat by creating a file1.new and then mv file1.new file1 to change the contents indirectly, so that's one to watch out for).
If /dir1 is read only, but /dir1/file1 is rw, then you won't be able to rename or delete file1 as both rename and delete are changes to the directory and not to the file.
The same concept applies to sub-directories.
BTW, Paul Sheer's rute tutorial is a good resource for this sort of stuff if you're not familiar with it.
Finally, I'd really recommend creating your own custom group for this purpose rather than reusing an existing group such as plugdev, which already has it's own defined purpose.
You're right. I can't modify a file created by the another user. I've been playing around with umask, reading information, but I don't know how to make it work. I've tried a few things with umask, but it's like I don't do anything.
I think the problem would be simply solved if anything created in these partitions (directories and files) would have write permissions for group "partitions" automatically (I've changed plugdev for partitions). I'm guessing that's were umask enters...
So this the /etc/profile I've tried out.
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "`id -u`" -eq 0 ]; then
if [ "$PS1" ]; then
if [ "$BASH" ]; then
if [ "`id -u`" -eq 0 ]; then
umask u=rwx g=rwx o=r
I'm not aware of any way to force permissions on a per filesystem level like you can do with FAT mounts.
The users umask and SGID on the directory in combination with a specific group assigned for the purpose are the only way I know to do this sort of thing (outside of ACLs, which I avoid because they have a tendency to be hard to manage and get messy).
BTW, that umask you added is a bit dodgy as it lacks 'x' on others which may cause problems with directories.
u=rwx,g=rwx,o=rx (umask 002) is the more usual way of doing that.
I've changed umask to 002 as you said. When I rebooted, everything was working as I hoped for.
So, what I did was...
1- Created a Group called partitions with: # addgroup partitions
2- Added both users to that group: # adduser USER partitions
3- Changed the group in the partitions I wanted: # chgrp partitions -R /media/Shared
4- Changed the permissions in these directories: # chmod g+rwxs -R /media/Shared
5- Finally edit /etc/profile and change umask value (022) with 002.