shell_exec sudo problem

Ask a Question related to FreeBSD, Design and Development.

  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. Similar Questions and Discussions

    1. sudo command
      hi guys, newbie question here: Just loaded the ubuntu image from VMWare that has "ubuntu" as default root password. However, if i do a "su"...
    2. [PHP] shell_exec
      * Thus wrote John (hippiejohn@cox.net): The odds are that the perl script is running the code. The problem most likely is permissions. The web...
    3. [PHP] shell_exec
      Rodney Green wrote: Shell side: - must be readable and executable by user (apache or perhaps everyone) - suid bit work only for programs, not...
    4. How to override SECURE_PATH in sudo?
      Hi, I am trying to setup sudo to allow users to run files under /opt/bin without having to type in the full path to the executable. In woody,...
    5. sudo doesn't work
      hi list, i have a little problem with my sudo here on debian v.3. what i would like to do: a php-based web-interface should be able to run some...
  3. #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 <paul@theharbour.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-questions@freebsd.org[/email] mailing list
    > [url]http://lists.freebsd.org/mailman/listinfo/freebsd-questions[/url]
    > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
    >

    --
    Met vriendelijke groet,
    Bas Essers
    Bas Essers Guest

  4. #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-questions@freebsd.org[/email]
    [mailto:owner-freebsd-questions@freebsd.org] On Behalf Of Bas Essers
    Sent: 19 February 2005 20:43
    To: [email]freebsd-questions@freebsd.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 <paul@theharbour.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-questions@freebsd.org[/email] mailing list
    > [url]http://lists.freebsd.org/mailman/listinfo/freebsd-questions[/url]
    > To unsubscribe, send any mail to
    "freebsd-questions-unsubscribe@freebsd.org"
    >

    --
    Met vriendelijke groet,
    Bas Essers

    Paul Guest

Posting Permissions

  • You may not post new threads
  • You may 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