search

Home  >  Q&A  >  body text

linux - 初学服务器设置,网站目录权限一直没弄明白到底应该怎么设置

我安装的是ubuntu server,FTP软件是vsftpd,WEB服务器软件是apache,

假如网站目录是:/var/www ,FTP使用本地账号:ftp_user,apache是:www-data,

应该把网站目录交给哪个用户?我都有试过,总有些问题如没权限访问、FTP不能删除此类问题。

请教正确的处理方式应该是什么,既能正常使用,也能保证安全。

阿神阿神2784 days ago718

reply all(2)I'll reply

  • 阿神

    阿神2017-04-17 11:38:45

    Be sure to use FTP.

    Add ftp_user to the www-data group, and then set /var/www to be owned by ftp_user, the group is www-data, and the permissions are 750. For directories that require write permissions for the web server, press g+w.

    reply
    0
  • 黄舟

    黄舟2017-04-17 11:38:45

    Generally speaking, the permissions of ftp should be consistent with the permissions of apache, for example, both use the www-data user. This can avoid many permission problems, such as ftp being unable to modify or delete files, apache showing 403, etc.
    If there is more than one user using ftp to upload, and you want to distinguish between different users, you can put all ftp user accounts and www-data into the same group.

    reply
    0
  • Cancelreply