How to configure vsftpd for access to /var/www/html

Issues related to applications and software problems
Post Reply
rtcary
Posts: 140
Joined: 2005/10/13 18:40:55
Contact:

How to configure vsftpd for access to /var/www/html

Post by rtcary » 2018/03/24 02:24:02

Before I install vsftpd, I want to make sure I and a co-worker can access /var/www/html. Currently the directories are owned by apache:apache with 774 permissions. My intent would be to add ftp to the apache group.

Both users are members of the apache group.

Will this work? Do I need to make changes?

Thank you for your advice...

Todd

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: How to configure vsftpd for access to /var/www/html

Post by hunter86_bg » 2018/03/26 04:21:41

Most probably you nees to tell SELinux that both httpd and ftp will access same folders.
So, first - change the default domain as follows (public_content_rw_t for rw access and public_content_t for ro):

Code: Select all

semanage fcontext -a -t public_content_t "/var/www/html/document_root(/.*)?" 
&& restorecon -RFvv /var/www/html/
If you need apache to have write access (rw_t), then you should enable the following:

Code: Select all

setsebool -P allow_httpd_anon_write 
And possibly this one:

Code: Select all

setsebool -P allow_httpd_sys_script_anon_write
Also if you want to allow the vsftpd to write there also:

Code: Select all

setsebool -P allow_ftpd_anon_write
To see if selinux is still preventing something use(setroubleshoot-server package is needed):

Code: Select all

sealert -a /var/log/audit/audit.log

Post Reply