I have tried different things with chmod and adduser commands but it will take too much time for me to do this.
Here is what I try to do:
Lets say I will add 3 users to my system. Each user can read the files in the home directories of others but cannot write in it cannot change them. Each user can only write to their own home directory. Also there will be one common directory that everyone can write and read. I have a lot of users. I don't want to add each one by one.
Thanks a lot for helping :)

  • that should be how its set by default as for the directory that everyone can have access too .. you just need to create that directory and chmod it as 777 which will give all users read/write/execute. One note though... if any user has sudo privileges then they will still be able to edit other users folders and files – John Orion May 23 '16 at 18:31

By default the umask for users creates files with 644 permissions or rw-r--r-- which allows all users to read but only the own to write, default permissions for directory creation is 755 which is rwxr-xr-x for a directory the execute bit (x) is interpreted differently and represents permission to list the contents of said directory.

Thus you could do what you require by ensuring that the user home directories themselves are set to 755, of course users can change the permissions of files they own so each user would have the ability to make some or all of their files and directories private from other regular users if they wished.

Root of course can read and write to files regardless what permissions the owner may have set.

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.