Linux Servers & File Permissions
One of the things that I miss from running my web server on Windows XP was that I never needed to configure file permissions, or grant Apache access to each file, on my server - no matter where a file came from, it would pretty much always work in-browser. This is probably a bit less secure, but I value not having to open terminal on the server and chmod all newly uploaded files (via FTP), after being edited or whatnot.
When I first set up my Apache server on Ubuntu, I was confused as to what I should set the general file permissions to. What users/groups? If I allow full access to "everyone," does that mean "everyone," or just everyone with access to the local file system? Since then I sort of figured out a solution, setting the web pages to 775, with the primary user being the root account, g73net, the secondary being www-data (Apache's user), and 5 (r-x) for all else. I still find this annoying to have to change every time I create a file, etc., especially when I connect remotely via FTP.
Is there any easy way to do the permissions automatically, without umask, and scripts that overwrite the wrong files' permissions? :P
When I first set up my Apache server on Ubuntu, I was confused as to what I should set the general file permissions to. What users/groups? If I allow full access to "everyone," does that mean "everyone," or just everyone with access to the local file system? Since then I sort of figured out a solution, setting the web pages to 775, with the primary user being the root account, g73net, the secondary being www-data (Apache's user), and 5 (r-x) for all else. I still find this annoying to have to change every time I create a file, etc., especially when I connect remotely via FTP.
Is there any easy way to do the permissions automatically, without umask, and scripts that overwrite the wrong files' permissions? :P
Comments
If this is too hard to answer, what, for example, are the file permissions on the WinBoards server? Are they automatically updated? well, I'd guess not, since stuff isn't really uploaded directly...
but I'm curious as to how you would recommend this be set up.
The default umask of 022 should work just fine. Yes, that does mean that everyone can read the files, but that's what you want for a website.
If you have exceptions to this. I.E. files you don't want everyone to read (they shouldn't be in a web directory anyway) or script files that need to be executable, set their permissions manually.
Also, I'm not sure I understand how to define the permissions of a usergroup; if it's really all based on access given to files (i.e. /cdrom), then how would I allow multiple groups to utilize a file, if there are only two areas for users or groups in permissions? (i.e. "root root drwxrwxr-x"; I can replace the second "root" with a group, but what if I wanted a user and two groups to have access/permission nodes? (etc.))
http://www.computerhope.com/unix/usetfacl.htm
A couple givens:
1. Home directory root is set to /filez/. There is a good tutorial here on how to set this up: http://www.cyberciti.biz/faq/howto-chan ... directory/
2. proFTPd is installed and configured.
3. My root domain name has an alias A record configured in DNS. IE, *.taldar.in points to 216.240.243.41 in my case.
So I keep "add" in my root directory. If I ever want to add a user I invoke the script by typing "bash add".
As for FTP, my preference would be to just use SFTP, that way I wouldn't have to install anything extra and my users would have a little security when it comes to transfering their files.
Of course, with your way, the choice is theirs whether they want to use SFTP or FTP.
I actively run SFTP and FTP alongside. I left out the crypto configuration steps required for proFTPD to do this, but you can find it on the internet.