I have website folder called
/home/john/public_html
Now i want that what ever files are copied to that public_html or new files created inside that folder then those files should have default read /write permission by john , no matter who is the owner of that file.
Also i will be copying /creating files /directories by FTP , will that system work there as well or file with ftp won't have group read /write permission
i mean will umask work only files created / copied within shell or even outside shell aswell
You can achieve this using ACL. Look at the man page of setfacl/getfacl for details.
Unfortunately the syntax is a bit complex. Try something like:
Well, umask will still aply to newly created files, but you can "override" umask as well using ACL:
I'm not exactly sure what you're trying to accomplish, but it looks like it could be solved with group permissions and a setgid bit on the directory.
Then when people create files, they'll be owned by the group 'john-contrib'. Everyone needs to be a member of john-contrib to put files in John's directory though.
If you really want everyone to write into John's directory all the time without any security controls... then chmod 2777 would work, but that's a little insane application of the /home filesystem.
If you are root on the server, you can no doubt configure the FTP server to set specific permissions on uploaded files. To make just ANY file moved in to public_html get r/w for john is another deal. Perhaps you could make a script to change group on all files in public_html. Then make sure the script loops every 1 second or something. I would not call this a good way, but I can not think of another...