-1

I have a folder I'm sharing with another user in a linux centos 7 box. even though I've set the permissions for the full folder to 777 it still locks new files created by the other user.

the folder is /data folder. How do I tell linux, "all files currently in /data and every file ever created in /data should always and forever be completely available for anyone to do anything they want to"?

I've already tried a few things but I'm new to linux so I don't really understand. I know how to use chmod to change permissions but it seems those changes don't persist on new files even if I make those changes to the directory itself.

MetaStack
  • 381

1 Answers1

2

The permission of files that you create is defined by the umask of a user during creation-time. You can see my umask by:

ljm[~]$ umask
0022

A user can set his umask with:

umask 0000

(This effectively makes every file readable and writable by everyone; don't do this)

In general, the permissions are determined by the owner of the file. This is called discretionary access controll. As owner, you can do:

chmod a+rw /data/file

If you are root on the system, you can do this for all files. You might even put a line in crontab for root that runs chmod -R a+rw /data every minute or so.

But, unless you are very good friends with all the other possible users of the computer (even all the passer-by's or hackers that may gain access to your system), don't do this. A solution in a security-relaxed environment might be:

  • create a group for access to /data; chown root.datagrp /data
  • make the directory 3777 (chmod 1777 /data). In this way users can delete their own file. but not others and all the files will be of the group datagep
  • set umask for all users on 0002 and add the users to the datagrp

And really read-up on Unix/linux permissions; search for "unix file permissions umask explained" in google.

Ljm Dullaart
  • 4,643