I am trying to figure out "To Solve Permission Denied Problem for script.py" python script Hosted on UBUNTU Linux apache2 server. The app is facing problem when I try to use
os.mkdir(os.path.join("/var/www/mysite.com/public_html/uploads", "newfolder"))
Note - app is using mod_wsgi, flask and python 3.x.x version.
This raises an Error 13 Permission denied error. However I tried the same from command line through putty by using
python3
import os
os.mkdir(os.path.join("/var/www/mysite.com/public_html/uploads", "newfolder"))
This created the folder actually. But I don't know why script is failing to create the same in case of execution.
Also Permission is set to "775" for script.py file.
Related
I am quite new to linux set up and I am finding it really tough to make my jenkins machine talk to a python program residing in a linux server.
Here are the details:
I have a python file which resides in a path '/filenet/EFBI/Scripts/Test_Scripts/add.py'
I have created one Jenkins Job to run the add.py file which has the JenkinsHome path set in the same linux machine -'/jenkins/jenkins_fmlvlm0000/jenkins2_176/Jenkins_Home'
I donot have access to the workspace file inside the Jenkins_Home (using a user to login to the linux box).
In the Jenkins Job configuration I have written the below code:
#! /usr/local/bin python3
python3 /filenet/EFBI/Scripts/Test_Scripts/add.py
When this gets executed receiving a error:
started by user Jenkins Admin User
Running as System
Building in workspace /jenkins/jenkins_fmlvlm0000/jenkins2_176/Jenkins_Home/Workspace/PythonTest
[PythonTest] $ /usr/local/bin python3 /jenkins/jenkins_fmlvlm0000/jenkins2_176/apache-tomcat-9.0.20/temp/jenkins123456789.sh
FATAL : command execution failed
java.io.IOException: error=13, Permission Denied
....
....
....
....
caused: java.io.IOException: cannot run program "/usr/local/bin" (in directory "/jenkins/jenkins_fmlvlm0000/jenkins2_176/Jenkins_Home/Workspace/PythonTest"): error=13, Permission Denied
Now I have below questions:
Where am I going wrong?
How to find out which user is being used to interact between jenkins and linux python program?
Is this a permission issue and what all permission be required?
The issue is resolved now.
We had to create a slave node and then in the linux machine create a worker folder for the agent to work.
And then in the set up create the same user ID and password through which we are logging into to linux machine and then provide required SSH permission to make it work.
I'm working on MAC application contains a command line tool.
The GUI (electron) using sudo prompt to run the command line tool written in Python.
Under Catalina, the app all needed permission to w/r for the protected directories like Desktop with no issue.
Needed permission request were added to plist and it is signed with list of entitlements.
All works well except accessing external hard drive. Any try to create folder or modifying its properties using chmod command for example return with permission denied.
Just for note, calling same command from terminal ends well with no issue
Any ideas how I can go over it?
How App can request Full disk access?
I have a Flask app hosted on a Linode server. I have a script to fetch a json and write it to a file. When I run this script getprice.py on my server I get the error [Errno 13] Permission denied: 'app/static/prices.json. It works fine on my local machine though. What do I have to do to get it working?
The answer is in your question. The user your script is running as on the server doesn't have write permissions on 'app/static'. It may be helpful if you also posted the getprice.py code, but it seems like a pretty straightforward file permission problem.
I'm trying to run my selenium scripts via Jenkins on Ubunt server 16.04 without GUI.
And before to open a web page it requires make an windows authentication. I created for Windows with AutoIT and it works good but now I have to execute via Jenkins on Ubunt server, and got the following error:
Using deprecated data structure for setting timeouts
java.io.IOException: Cannot run program "/usr/share/GlobalStagingERP/global.staging.erp/authentification/WindowsAuthenticationFireFoxCodeExample.exe": error=13, Permission denied
And I decided to do it with python and SciTE.
Also I tried 'https://username:password#my_url/' but it didn't work and got a fatal error.
This is an example how I'm using AutoIT script to handle authentication in window:
WinWaitActive("Authentication Required","")
MouseClick("left",331, 288,1)
Send("username")
Send("{TAB}")
Send("password")
Send("{ENTER}")
But how can I do it the same action in SciTE using python?
Not certain if this belongs here or on SU
I'm developing a Django app and I'm having a problem with logfiles. I have a logger configured to write to /var/log/django/django.log. When I try to start the server, I get a 500 error, and the error log says
ValueError: Unable to configure handler 'djangologfile': [Errno 13] Permission denied: '/var/log/django/django.log'
"httpd/error_log" 480L, 61112C
The permissions for both django.log and the django directory are 777. Why can't the server write to the file?
Well, the easy way to test this is to sudo as a user the server is running under and try to ls /var/log/django/django.log. If that fails you might get insight into what the problem is.