Question about running script in jail

Status
Not open for further replies.

Joshua Walker

Dabbler
Joined
May 8, 2017
Messages
23
Im trying to run a python script from my jail but im getting no where. I installed python27 but when i type python, i get unknown command. So then I found that it was located in usr/local/bin/python2.7. When I run that, I fall into python. In my script, i add the path to the top of the script but now I get /usr/loc
al/bin: bad interpreter: Permission denied when run the script (/media/Scripts/myscript.py) /media/Scripts is a storage I added to the jail.

Sent from my SM-G950W using Tapatalk
 

Joshua Walker

Dabbler
Joined
May 8, 2017
Messages
23
ok so update to my situation

if i try to run
Code:
/media/script/myscript.py 
i get permission denied
if i try
Code:
python2.7 /media/script/myscript.py
it works.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
did you give the script execute permissions? You also need a shebang in the script.
 

Joshua Walker

Dabbler
Joined
May 8, 2017
Messages
23
Code:
-rwxrwxrwx   1 media  wheel  10739 May 12 20:36 MediaMgmt_local.py


Code:
#!/usr/local/bin python2.7
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
You use just pyrhon2.7 what is the full path? which python2.7 should show you.

Sent from my Nexus 5X using Tapatalk
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Code:
-rwxrwxrwx   1 media  wheel  10739 May 12 20:36 MediaMgmt_local.py


Code:
#!/usr/local/bin python2.7

ahhh! is see what you did. There should not be a space between the /bin and python2.7. It should all be the same path to the executable. You can also just use /usr/local/bin/python, this is probably what i would do. No reason to force python2.7 especially since you should be working more in python 3 nowdays.
 

Joshua Walker

Dabbler
Joined
May 8, 2017
Messages
23
Ok.. I will give it a try. I also added a alias in the crsh file so I could use python instead of python2.7.

Sent from my SM-G950W using Tapatalk
 

Joshua Walker

Dabbler
Joined
May 8, 2017
Messages
23
ok so i figured it out.

i removed my alias entry in the .cshrc, made a link
Code:
ln -s /usr/local/bin/python2 /usr/local/bin/python
, added
Code:
/usr/local/bin/python
to env and put the shebang back to
Code:
#!/usr/bin/env python
and everything works
 
Status
Not open for further replies.
Top