Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making a Python script executable chmod755?

Tags:

python

hosting

My hosting provider says my python script must be made to be executable(chmod755). What does this mean & how do I do it?

Cheers!

like image 713
Solihull Avatar asked Dec 23 '22 11:12

Solihull


2 Answers

If you have ssh access to your web space, connect and issue

chmod 755 nameofyourscript.py

If you do not have ssh access but rather connect by FTP, check your FTP application to see whether it supports setting the permissions.

As to the meaning of 755:

  • first digit is user settings (yourself)
  • second digit is group settings
  • third digit is the rest of the system

The digits are constructed by adding the permision values. 1 = executable, 2 = writable and 4 = readable. I.e. 755 means that you yourself can read, write and execute the file and everybody else can read and execute it.

like image 118
dseifert Avatar answered Dec 24 '22 23:12

dseifert


Unix-like systems have "file modes" that say who can read/write/execute a file. The mode 755 means owner can read/write/execute, and everyone else can read/execute but not write. To make your Python script have this mode, you type

chmod 0755 script.py

You also need a shebang like

#!/usr/bin/python

on the very first line of the file to tell the operating system what kind of script it is.

like image 21
Dave Avatar answered Dec 24 '22 23:12

Dave