setuid root

Discussion in 'Python' started by Tiago =?iso-8859-1?Q?Sim=F5es?= Batista, Aug 24, 2006.

  1. Hello all

    I have a situation that requires that a python script, that is
    run from a webpage (via php exec()) must be run with root privileges.

    The sysadmin already set the setuid bit on the script, but it
    still fails when it tries to write to any file that only root has
    write access to.

    I read somewhere that any scripts that start with "#!" will no
    honour the setuid bit...

    I also tried os.setuid(0), with the setuid bit on, but this call
    failed.

    I am now out of ideas :(

    Any sugestions?

    Tiago
     
    Tiago =?iso-8859-1?Q?Sim=F5es?= Batista, Aug 24, 2006
    #1
    1. Advertising

  2. Tiago =?iso-8859-1?Q?Sim=F5es?= Batista

    Ove Svensson Guest

    Ove Svensson, Aug 24, 2006
    #2
    1. Advertising

  3. Tiago Simões Batista wrote:
    > The sysadmin already set the setuid bit on the script, but it
    > still fails when it tries to write to any file that only root has
    > write access to.


    use sudo.
     
    Patrick Useldinger, Aug 24, 2006
    #3
  4. On Thu, 24 Aug 2006 17:48:26 +0200
    Patrick Useldinger <> wrote:

    > Tiago Simões Batista wrote:
    > > The sysadmin already set the setuid bit on the script, but it
    > > still fails when it tries to write to any file that only root has
    > > write access to.

    >
    > use sudo.
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >


    Thank you, both fot you and for Ove Svensson.

    I was looking for a simpler way, that required as little intervention as possible from the main sysadmin. Given the situation I am facing, I will probably use sudo, it keeps things cleaner...

    Again, thank you

    Tiago

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.4 (GNU/Linux)

    iD8DBQFE7fRlcERmrF/iXCsRAoSGAKCXM2X6TaEXSE/IA4nS5SAUztc/ZgCghOKp
    K02Z57Xa+l9RDU1hhnPjy8w=
    =4BUk
    -----END PGP SIGNATURE-----
     
    Tiago Batista, Aug 24, 2006
    #4
  5. Tiago =?iso-8859-1?Q?Sim=F5es?= Batista

    matthewtsmall

    Joined:
    Jan 30, 2011
    Messages:
    1
    Write it in C

    Not exactly a python solution, but you could certainly call a c program with the SUID bit set from the python script to circumvent this. Just be careful that you limit the functionality of the c program to a specific task as it will have to be executable from the web account.
     
    matthewtsmall, Jan 30, 2011
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,283
  2. Rick Osborn
    Replies:
    10
    Views:
    3,994
    Jon A. Cruz
    Feb 8, 2004
  3. hector
    Replies:
    5
    Views:
    438
    CBFalconer
    Dec 5, 2006
  4. Archie邱
    Replies:
    0
    Views:
    170
    Archie邱
    Mar 9, 2006
  5. Archie邱
    Replies:
    1
    Views:
    139
    A. Sinan Unur
    Mar 9, 2006
Loading...

Share This Page