I have a virtual CentOS server with GoDaddy, and I'm having trouble setting up the permissions for /var/www/html
.
Users are not allowed to log in as root
, or even add themselves to the root
group, so here's the corner I've painted myself into:
I changed its owner using the following command (I used the user:group that was in
httpd.conf
):chown -R apache:apache /var/www/html
I added my own user to the
apache
group:usermod -a -G apache myuser
I changed the permissions:
chmod 777 /var/www/html -R
This is the only way to give my SFTP account the ability to create, change, and delete files in /var/www/html
. 777! (The SFTP account uses the same credentials as the ssh account, which means for all intents and purposes they're the same, right?)
I'm obviously new to Linux server admin, but this seems ridiculously insecure. Is there a better way to do all this?
Note The website I'm planning on putting up here will allow file uploads, cron jobs, etc., so I'm guessing that will complicate the necessary permissions as well. Is that correct?
Update Using 775 does not appear to work; I can upload/overwrite files, but when I just try to delete them, FileZilla gives me this error:
rm /var/www/html/index.php: permission denied
I have no idea why, but changing back to 777 "fixes" this.