1

I have recently installed Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-70-generic x86_64) and then the latest version of vsftpd as FTP server and the latest version of Apache2 as web server - by the latest I mean current stable version. I also added new user with his home directory as /FTP/user. FTP server works fine, user can upload and download everything to and from his home directory.

In the next step I configured Apache in order to display index.htm (file from /FTP/user) as simple website. I assigned permissions for 'www-data' user and website is properly visible using my configured domain name.

The problem is that when 'user' uploads a new 'index.htm' file to the folder, the website seems to be invisible and the following text is shown on the website:

Forbidden You don't have permission to access this resource. Apache/2.4.41 (Ubuntu) Server at /ServerName/ Port 80

When I change permission manually again everything comes back online, but problem occurs every time a new file is uploaded using FTP...

Please provide me with any suggestion what can I change in order to have my website always visible automatically after uploading new file.

Thanks in advance for your help!

1 Answer 1

1

This may be too simple of an answer, but you can give it a try:

Change the permissions on the parent directory to the ones that work when you manually change them on the file. In theory, when the file is uploaded, they should inherit those permissions? I could be wrong though!

sudo chmod -R <perms> <directory> or sudo chown -R <user> <directory>

Let me know if this works.

Edit: Found a link here if it is useful (https://unix.stackexchange.com/questions/287664/can-directories-and-file-inherit-same-permissions-as-parent-directory)

3
  • Thank you very much, but unfortunately it does not work for me... Nothing chanced and I still see Apache message about permission error.
    – Wojciech
    Commented Apr 5, 2021 at 16:28
  • @Wojciech apologies for that. Not sure what else you can do. Adding Apache to the list of sudoers is dangerous (depending on your use case) but relieves the problem - or at least in theory.
    – Vasilisa
    Commented Apr 6, 2021 at 10:01
  • Thanks for your efforts! I will try this way to resolve my problem, because this is only for education and experimental environment. In production it could be really bad idea, but not in my case, thanks! For your info I edited vsftpd config file and changed in it that files uploaded using FTP belongs to 'www-data' user instead of user who uploaded file - it fully resolved my problem, but also it is not so professional resolve I think...
    – Wojciech
    Commented Apr 6, 2021 at 12:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .