Set default permissions of a .py file to 755?

Reefive Sky

Registered
Jul 26, 2018
1
0
0
Canada
cPanel Access Level
Website Owner
Can I change some settings to make the default permissions of a .py file to 755?
Because if I have a .py writing system, I can't find a way to make it runnable without manually going into the files. I"m basically making a blog for someone, and they have no file managing or programming experience, so it would take me ages to teach them how to manually change the permissions.
Is there a way?

-~Reefive Sky
 

Nate Reist

Member
Jul 20, 2018
24
4
3
Michigan
cPanel Access Level
Root Administrator
This is more of a linux question I think than a cPanel. You could use find to do this in a linux environment via the shell. Find has an exec argument which you can run another command on the results. Basically you'd, find all .py files inside a directory and change the permissions on those files. For example:

Code:
find . -type f -name "*.py" -exec chmod 755 {} \;
Find all files ending in ".py" inside of the current directory ( . ) then have chmod set the permissions to 755. Find will automatically put the found files in the place of the {} in the exec command. The slash and semi-colon ends the find exec command so those are required.

Please be careful when batch updating stuff like this, you might want to test this in a controlled test environment, take backups.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
Hello @Reefive Sky,

Your access level shows as website owner. Without root access to the server, there's nothing you can really do to change the default permissions for new files or directories. With root access, you could alter the default umask settings configured with the OS, but even still that's not really a recommended method because you're only wanting to adjust the default permissions for .py files.

You'll sometimes see scripts that include a check to verify the proper permissions are set on specific files (e.g. .py, .cgi). You may want to develop something like that and include it as part of the website files so users can easily see a list of files that need permission changes.

You may also want to vote and add feedback to the following feature request:

https://features.cpanel.net/topic/ability-to-set-the-umask-for-cpanels-file-manager

Thank you.