Professional Web Applications Themes

shell_exec sudo problem - FreeBSD

For some reason I can't get sudo to work from an online php script using shell_exec. I have put this in the sudoers file: www ALL=(ALL) ALL (full access is temporary until I get it working) When I run: echo shell_exec("sudo echo hello"); in a php script in a web page running on apache2, it does nothing - I don't get any feedback. echo shell_exec("whoami"); confirms that www is the correct user. Any ideas? Paul...

  1. #1

    Default shell_exec sudo problem

    For some reason I can't get sudo to work from an online php script using
    shell_exec.



    I have put this in the sudoers file:

    www ALL=(ALL) ALL

    (full access is temporary until I get it working)



    When I run:

    echo shell_exec("sudo echo hello");



    in a php script in a web page running on apache2, it does nothing - I don't
    get any feedback.





    echo shell_exec("whoami"); confirms that www is the correct user.





    Any ideas?



    Paul

    Paul Guest

  2. #2

    Default Re: shell_exec sudo problem

    you should take a look at apache error log to see what sudo says.
    i''ve never used sudo but when i make a shell script SUID 0, bash tells me
    it is too dangerous to run a script in SUID 0. and that's probably
    true because a lot can be modified in a script thru the environment.


    On Sat, 19 Feb 2005 18:50:45 -0000, Paul <paultheharbour.eclipse.co.uk> wrote:
    > For some reason I can't get sudo to work from an online php script using
    > shell_exec.
    >
    > I have put this in the sudoers file:
    >
    > www ALL=(ALL) ALL
    >
    > (full access is temporary until I get it working)
    >
    > When I run:
    >
    > echo shell_exec("sudo echo hello");
    >
    > in a php script in a web page running on apache2, it does nothing - I don't
    > get any feedback.
    >
    > echo shell_exec("whoami"); confirms that www is the correct user.
    >
    > Any ideas?
    >
    > Paul
    >
    > _______________________________________________
    > [email]freebsd-questionsfreebsd.org[/email] mailing list
    > [url]http://lists.freebsd.org/mailman/listinfo/freebsd-questions[/url]
    > To unsubscribe, send any mail to "freebsd-questions-unsubscribefreebsd.org"
    >

    --
    Met vriendelijke groet,
    Bas Essers
    Bas Essers Guest

  3. #3

    Default RE: shell_exec sudo problem

    Found the problem in the log file - the sudo command wasn't being found.

    Thanks!



    -----Original Message-----
    From: [email]owner-freebsd-questionsfreebsd.org[/email]
    [mailto:owner-freebsd-questionsfreebsd.org] On Behalf Of Bas Essers
    Sent: 19 February 2005 20:43
    To: [email]freebsd-questionsfreebsd.org[/email]
    Subject: Re: shell_exec sudo problem

    you should take a look at apache error log to see what sudo says.
    i''ve never used sudo but when i make a shell script SUID 0, bash tells me
    it is too dangerous to run a script in SUID 0. and that's probably
    true because a lot can be modified in a script thru the environment.


    On Sat, 19 Feb 2005 18:50:45 -0000, Paul <paultheharbour.eclipse.co.uk>
    wrote:
    > For some reason I can't get sudo to work from an online php script using
    > shell_exec.
    >
    > I have put this in the sudoers file:
    >
    > www ALL=(ALL) ALL
    >
    > (full access is temporary until I get it working)
    >
    > When I run:
    >
    > echo shell_exec("sudo echo hello");
    >
    > in a php script in a web page running on apache2, it does nothing - I
    don't
    > get any feedback.
    >
    > echo shell_exec("whoami"); confirms that www is the correct user.
    >
    > Any ideas?
    >
    > Paul
    >
    > _______________________________________________
    > [email]freebsd-questionsfreebsd.org[/email] mailing list
    > [url]http://lists.freebsd.org/mailman/listinfo/freebsd-questions[/url]
    > To unsubscribe, send any mail to
    "freebsd-questions-unsubscribefreebsd.org"
    >

    --
    Met vriendelijke groet,
    Bas Essers

    Paul Guest

Similar Threads

  1. sudo command
    By Huy Pham in forum Ubuntu
    Replies: 13
    Last Post: February 5th, 12:29 AM
  2. [PHP] shell_exec
    By Curt Zirzow in forum PHP Development
    Replies: 0
    Last Post: August 17th, 10:49 PM
  3. [PHP] shell_exec
    By Christophe Chisogne in forum PHP Development
    Replies: 1
    Last Post: August 6th, 02:56 PM
  4. How to override SECURE_PATH in sudo?
    By John Zaitz in forum Debian
    Replies: 0
    Last Post: August 5th, 11:00 AM
  5. sudo doesn't work
    By Yves Goergen in forum Debian
    Replies: 3
    Last Post: August 3rd, 02:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139