Raspberry [Errno 13] permission denied opening file txt - admin

I am using a raspberry pi 3 with Jessie.
In my code, I need to read a file.txt in a loop but i got the error N13 saying Permission denied: 'file.txt'.
I am running the code using thonny.
Any solution ?
i solved from cmd window tiping sudo python3 filename.py
but i need to do it everytime i want to launch the code, there is a way to make it definitive?

Check FILE PERMISSIONS.
Do it from root.
Whenever there is permission denied error appears/occurs, its either file permissions in case of files or wrong password entered.

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.

ERROR: [050]: unable to acquire lock on file '/tmp/pgbackrest/demo-archive.lock': Permission denied

I have been trying to load data incrementally in postgres on linux(ubuntu) from the source (https://access.crunchydata.com/documentation/pgbackrest/2.00/pdf/backrest.pdf) while I am trying to create a stanza I am getting the following error.
As I am new to the Linux platform it has been taken more then 2 days and I couldn't solve it!
sudo -u postgres pgbackrest --stanza=demo --log-level-console=info stanza-create
2019-10-03 16:16:22.730 P00 INFO: stanza-create command begin 2.16: --log-level-console=info --pg1-path=/var/lib/postgresql/11/demo --repo1-path=/var/lib/pgbackrest --stanza=demo
ERROR: [050]: unable to acquire lock on file '/tmp/pgbackrest/demo-archive.lock': Permission denied
HINT: does the user running pgBackRest have permissions on the '/tmp/pgbackrest/demo-archive.lock' file?
2019-10-03 16:16:22.730 P00 INFO: stanza-create command end: aborted with exception [050]
ERROR: [050]: unable to acquire lock on file '/tmp/pgbackrest/demo-archive.lock': Permission denied
HINT: does the user running pgBackRest have permissions on the '/tmp/pgbackrest/demo-archive.lock' file?
2019-10-03 16:16:22.730 P00 INFO: stanza-create command end: aborted with exception [050]
What is the reason why this is showing and how to solve it?
I faced the same issue and solved by just deleting the temp folder and its files
sudo rm -r pgbackrest/
It worked for me.
Another possible solution is to delete the temp folder and stanza & re-create the stanza.

Permission denied. Error code: 3 Error message from server: Permission denied

I am logging into my amazon aws production box using WinSCP and i have successfully setup Tomcat 6. But in webapps folder when i transfer some webservice i get error as:
Permission denied.
Error code: 3
Error message from server: Permission denied
Please help me out to resolve this issue
You haven't mentioned what instance type you are using, but it sounds like you are on some flavor of Linux. You need to chmod or chown the webapps directory so you can place files there, or you can place them elsewhere (like your home directory), then log in and use sudo mv to move it in place.