Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Can the user a script runs as be changed?

by tachyon (Chancellor)
on Jul 02, 2004 at 03:44 UTC ( [id://371292]=note: print w/replies, xml ) Need Help??


in reply to Re: Can the user a script runs as be changed?
in thread Can the user a script runs as be changed?

This is IMHO bad advice. Firstly it simply won't work for many configurations and secondly suid root and web servers are a dangerous combination - especially if someone needs to have suid explained to them. There are other, safer ways to skin this particular cat.

  • Comment on Re^2: Can the user a script runs as be changed?

Replies are listed 'Best First'.
Re^3: Can the user a script runs as be changed?
by nightwatch (Scribe) on Jul 02, 2004 at 04:18 UTC

    The original author didn't specify whether it was running on a web server or not - the instance of a CGI script hadn't occurred to me actually. Yes, CGI scripts shouldn't be run suid root.

    Perhaps the author could clarify?

      Ah, very good point. Don't know why I thought it was a CGI question having just re-read it (can you change root node ins SOPW - I could have sworn it originally said CGI/nobody/apache somewhere). I like jacques answer the best so far ;-)

Re^3: Can the user a script runs as be changed?
by Lexicon (Chaplain) on Jul 04, 2004 at 17:44 UTC
    Just because it's dangerous isn't a reason not to teach it to them. Everyone has to learn about it for the first time sometime. It is responsible to give them the "But don't do that." disclaimer, though.

      Everyone has to learn about it for the first time sometime.

      Of course they do but hopefully by that stage they have discovered the man pages and/or read a basic book. Of the two objections I raised the first was the fact that you typically can't run suid scripts on a large number of the servers out there without recompiling the kernel to remove that restriction or wrapping the script with a short C execv() function. Have you ever actually tried it?

      [user]$ cat test.pl #!/usr/bin/perl print "This is a suid test\n"; [user]$ chmod +s test.pl [user]$ ll rover.pl -rwsr-xr-x 1 user coders 203 Mar 10 02:41 test.pl [user]$ ./test.pl Can't do setuid [user]$ su root Password: [root]# ./test.pl This is a suid test [root]# exit exit [user]$ ./test.pl Can't do setuid $ uname -sr Linux 2.4.18-27.7.xsmp $

      cheers

      tachyon

        I've never needed to do anything in this arena, but my comments aren't about what is the right thing to do. I just wanted to emphasize that it's good to talk about all available options. 1) It helps you understand the underlying mechanics better. 2) When you see a new option, you might realize that you were going about it all wrong anyway, and rearranging your code around the new option would increase elegance. I would rather say, "setuid is an answer, but it's the wrong one." than not mention it at all. That's all.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://371292]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-26 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found