Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Set default permissions of a .py file to 755?

Discussion in 'General Discussion' started by Reefive Sky, Jul 26, 2018.

  1. Reefive Sky

    Reefive Sky Registered

    Joined:
    Jul 26, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    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
     
  2. Nate Reist

    Nate Reist Member

    Joined:
    Jul 20, 2018
    Messages:
    8
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    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.
     
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice