Ljubisa Livac
Ljubisa Livac

Reputation: 832

Django uploading file - permission denied

I've tried everything that i've found regarding this problem, but nothing helped me to solve this issue.

When i try to upload something on my web site i get this error:

OSError: [Errno 13] Permission denied: '/home/****/www/site.com/media/news/some_file.pdf'

ls -l media gives me next:

drwxrwxr-x 2 www-data www-data 4096 Oct 11 23:13 news

so permissions are OK.

Everything was working well with development server but now in production i just cant upload anything.

How to fix this?

Upvotes: 1

Views: 1522

Answers (1)

Ljubisa Livac
Ljubisa Livac

Reputation: 832

As a noob for linux/apache I didn't know that default user for apache in CentOS (that i'm running on my server) is apache and not www-data.

So chown -R apache:apache media did the trick.

In last few days i've searched a bunch of topics regarding this problem and none of them did mention that there's other default user but www-data. It looks like that most of users are runing Ubuntu as everyone is talking about www-data.

Upvotes: 1

Related Questions