My friend and I built a server and run it out of the data center he works in. Its more for fun than anything else since all the websites we run get virtually no traffic. So while security for us isn't a huge thing, I still want to learn more about it so we don't have problems in the future. We are running the latest Ubuntu.

One of the problems we have consistently had is the file permissions. When I upload new files via FTP, the default permission setting is 600. Then I have to manually change the permissions to 775 or 777 to be able to view the files in the browser.

Question 1:
I know setting them to 777 is not the correct setting, so what should I be setting them at? Should different types of files have different settings?

Question 2:
How do I change the server so that the correct file permissions as assigned by default? Someone told me to change the umask settings, but that doesn't seem to do anything for files created via FTP.

Normally you would want them set to 755 with a umask of 022. There are a couplle of places you can set this depending on the ftp server you have running.

in /etc/inetd.conf

ftp stream tcp nowait root /usr/lbin/ftpd ftpd -u 022

In /etc/xinetd.d
server_args = -l -a -u 022

If you are running vsftp like I am:
In /etc/vsftpd/vsftpd.conf

# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.