#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    2
    Rep Power
    0

    CHMODding from cgi


    How do I do this because I don't understand the chmod values available (S_ISUID, etc) and the Python documentation (stat module, apparently) is no help.

    I'm gonna be doing this via an CGI script from my website. The file I'm trying to CHMOD will initially be 664, I believe. I need it to be at least 647.
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,615
    Rep Power
    4247
    The S_XXX are just a bunch of constant values and you're supposed to logical-OR them to get your permissions value. They are just there to give symbolic names to a bunch of values. In your case, you already know what the final permissions value is supposed to be (647 in octal), so you can to do is:
    Code:
    os.chmod("/path/to/file", 0647)
    Note the leading 0, which tells it that it is an octal number.
    Last edited by Scorpions4ever; May 17th, 2004 at 06:59 PM.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo