/ var目录的权限/ www / html等 [英] Permissions for /var/www/html

查看:2085
本文介绍了/ var目录的权限/ www / html等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与GoDaddy虚拟CentOS的服务器,我有麻烦了的/ var / www / html等设置的权限。

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:


  • 我改变使用下面的命令它的主人(我使用的用户:组是的httpd.conf

chown -R apache:apache /var/www/html


  • 我说我自己的用户到阿帕奇组:

    usermod -a -G apache myuser
    


  • 我改变了权限:

  • I changed the permissions:

    chmod 777 /var/www/html -R
    


  • 这是给我的SFTP帐户​​创建,更改的能力的必由之路,的删除的/ var / www / html等文件。 777! (该SFTP帐户​​使用相同的凭据ssh帐号,这意味着所有意图和目的,他们是一样的,对吧?)

    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?)

    我显然新的Linux服务器管理员,但这似乎可笑不安全。有没有更好的方式来做到这一切的?

    I'm obviously new to Linux server admin, but this seems ridiculously insecure. Is there a better way to do all this?

    注意网站,我打算把这里将允许文件上传,cron作业等,所以我猜会以及必要的权限复杂化。这是否正确?

    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?

    更新是775似乎并没有工作;我可以上传/覆盖文件,但是当我只是试图删除它们,FileZilla中给了我这个错误:

    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:许可被拒绝。

    rm /var/www/html/index.php: permission denied

    我不知道为什么,但变回777修复这一点。

    I have no idea why, but changing back to 777 "fixes" this.

    推荐答案

    您只需要 775 的/ var / www / html等只要你是作为myuser的登录。在 7 八进制中间(这是组中的ACL),确保组有权读/写/执行。只要你属于拥有该文件的组,为myuser应该可以写信给他们。您可能需要给组的权限在docuemnt根的所有文件,但是:

    You just need 775 for /var/www/html as long as you are logging in as myuser. The 7 octal in the middle (which is for "group" acl) ensures that the group has permission to read/write/execute. As long as you belong to the group that owns the files, "myuser" should be able to write to them. You may need to give group permissions to all the files in the docuemnt root, though:

    chmod -R g+w /var/www/html
    

    这篇关于/ var目录的权限/ www / html等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆