Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

So I have a small server setup (2 webs, 1 nfs / mysql) that's hosting a couple of different wordpress sites. It's currently configured like this:

I have a user called wwwuser (uid 500) and corresponding group wwwuser (gid 500). PHP-FPM runs as this user. Nginx runs as the regular nginx user.

My regular users are then created as "oscar" (uid 501), "wilma" (uid 502) and wwwuser as primary group. Users can upload files to the NFS server with SFTP, they have a sftp-only account chrooted in their www directory. They cannot login to the webservers.

umask is set to 002 for wwwuser, oscar & wilma. Files are set to 664, and directories 775, except wp-config.php which is 600.

This means that users can upload files via wordpress, update addons etc, ownership of these files become wwwuser:wwwuser.

This works very well, no need for chmod 777 or permission/ownership issues. Setting up a new WP instance is basically just adding a user in the right group, and everything works.

But is it sane from a security perspective? I guess users could theoretically write into other users directories, but they are chrooted with a restricted shell only allowing SFTP.

I don't want to have to set lots of individual permissions for files and folders, but I don't want to be an open door for hacking either. Should I look at something like suexec, selinux or is this secure enough?

Regards Oscar.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.