Thread: Perl and suid

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

    Join Date
    Jun 2000
    Posts
    300
    Rep Power
    14
    Is there a way to write a Perl script that would run as a different user?? To be more specific, I want to write a Perl CGI program that would change user as soon as it is executed. Of course, the user executing the program would be the user Apache runs under (nobody or www).

    So, again, is there a way to do this, or will I have to write a small C program to do this?? (Please tell me no... )
  2. #2
  3. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    This is actually an Apache question. It doesn't matter whether it's Perl or PHP or any others, you just can't change the user Apache runs as within your script.

    That's why you need SuEXEC or Cgiwrap to accomplish your task.
    Another way is to recompile Apache and add -DBIG_SECURITY_HOLE to the EXTRA_CFLAGS line or your src/Configuration file. That is, your Apache is capable to run as root. Be warned, you need to know what you are doing when running Apache as root.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    300
    Rep Power
    14
    So there is only that way?? OK, then, SuEXEC is the way, since running Apache as root is not something to be toyed with.

    Another question, as a follow-up: any good tutorials or documents on SuEXEC and how to use it??
  6. #4
  7. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    300
    Rep Power
    14
    Thanks a lot. Will read these docs and see what I came uo with...

    Thanks again.

IMN logo majestic logo threadwatch logo seochat tools logo