django - Permission denied in uploading photos - django

When I try to upload an Image, I am getting an error:
OSError at /
[Errno 13] Permission denied: '/home/ubuntu/project/django-user-activities/django_user_activities/static/media/uploaded_files/1422722471_11_Tulips.jpg'
I think its related with user permission. But since I am a windows user, and I am hosting this in a ubuntu 14.04 OS, I have no idea how to solve this. How do I resolve this problem/error? I would be very much grateful if you could help me. Thank you.

The shotgun command for all permission problems:
sudo chmod -R 777 /home/ubuntu/project/django-user-activities/django_user_activities/static/media/
Please note though that this is almost never a good idea...
Read this if you want to do it properly: https://superuser.com/questions/19318/how-can-i-give-write-access-of-a-folder-to-all-users-in-linux

Related

Django-import-export-celery Import error [Errno 13] Permission denied

I have a minor issue where I always see an error 13:
Import error [Errno 13] Permission denied: '/_/_/_/media/django-import-export-celery-import-change-summaries'
I can still import but I cannot see the end HTML template.
It's supposed to look like this (on my windows localhost):
I believe the blank summary is also caused by the Ubuntu file permission issue but I do not want to do anything because as I understand it, granting permissions on a production server is dangerous. Any help is appreciated. Thanks!
I just enabled permission with chown 755

Permission error when writing files in django + ubuntu + apache

Following is the error message I receive when I save x.mp3 via django :
Exception Type: PermissionError
Exception Value:
[Errno 13] Permission denied: 'x.mp3'
You should use the sudo command for super user.
because, the sudo enables the full access to files in your system.
So use sudo command to write the files for x.mp3
You can use this command in all linux platforms like kali,ubuntu,django,parrot.
Problem solved.
If you have any questions please be free to ask.
Vote for me

AWS Lambda: failed with error [Errno 13] Permission denied: '/var/task/lambda_function.py

I have the following CI/CD setup with Gitlab for deploying my lambda function
When it runs no error happens but when I try executing the function I receive the "failed with error [Errno 13] Permission denied: '/var/task/lambda_function.py" error. Is there any way to solve this? I've found this article in which aws suggests using chmod to give file permissions, but it didn't help.
BTW: I've ran the same commands locally in my machine and no error happens when running the function
Thanks in advance for any answer.
UPDATE: CloudWatch Logs below
I think you have similar trouble like this one and another here on stackoverflow as well.
You have to manually set the permissions of the zip file.
quoting from the bug
The zip archive preserves file permissions, so if you have a 644
permissions file, deflate it and inflate it back up, you get 644
permissions for that file.
So to fix the issue, simply set the expected permissions
before deflation, in Lambda's case, something like 755 will do.

Can not access files uploaded to AWS

I am not sure if this post should be posted here on Server Fault site, but I saw some posts about AWS here on Stack Overflow, so I hope this one fits here too.
I got the following problem when zipping and uploading files written in Python and Windows 10 not Ubuntu to AWS lambda function:
[Errno 13] Permission denied
I tried chmod 644 on files before zipping them, but I still have the same issue. All files that I upload to AWS through zipping will have permission denied issue, any solution?
I checked as well other posts about this where they discussed using chmod on files before zipping them, but I got the same problem as well:
Post 1: https://github.com/aws/aws-cli/issues/3235
Post 2: https://forums.aws.amazon.com/thread.jspa?messageID=742422
Post 3: PermissionError: [Errno 13] Permission denied when accessing to aws ec2 accessing-to-aws-ec2
Any suggestions?

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?
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.