Django, I am getting "Permission Denied" when trying to access a directory that is given to an ftp user

1k views Asked by At

My django application (v1.8) is using a directory for exporting some csv files. This directory is something like: "/home/username/django_project/csv_out".

I have intentionally chmod the "csv_out" dir to 777.

My partner wanted to access this directory in order to download and inspect those csv files.

I created an FTP user like this:

useradd ftp_user -p somepassword -d /home/username/django_project/csv_out/ -s /bin/false

Since then I get a "Permission Denied" error from Django (was not getting that error before): The FTP Server is giving access to the folder without problem. Django "misbehaves".

IOError: [Errno 13] Permission denied: '/home/username/django_project/csv_out/weights_1.csv'

Am I doing something wrong?

PS: I am using proftpd ftp server

2

There are 2 answers

2
Alex Vyushkov On

You also need +x (search) permission on /home/username and /home/username/django_project/ directories for ftp_user

Try this

 chmod a+x /home/username
 chmod a+x /home/username/django_project/
1
Gary On

note your ftp user is different from your website user.
which user account you started your django website?