Professional Web Applications Themes

exec shell command from php - PHP Development

hi all; - When i run php.. what user am i using ? is it apache user (nobody) ?? - How can i execute useradd command from php ? should i write it in pearl/cgi ?? - I want to grant my user on my web a free pop account (or webmail) so i need to create an user with bin/false so he has no shell login but pop login .... how can i do this by php.. as exec('useradd ... couldn't be done only by root ..... what user should i do ? what solution .. i googled for ...

  1. #1

    Default exec shell command from php

    hi all;

    - When i run php.. what user am i using ? is it apache user (nobody) ??
    - How can i execute useradd command from php ? should i write it in
    pearl/cgi ??
    - I want to grant my user on my web a free pop account (or webmail) so i
    need to create an user with bin/false so he has no shell login but pop login
    .... how can i do this by php.. as exec('useradd ...
    couldn't be done only by root ..... what user should i do ? what solution ..
    i googled for virtual popuser .. and i didn't manage .. so i decided to do
    it this way
    any comment ?
    Nabil Guest

  2. #2

    Default Re: exec shell command from php

    You are the apache user.
    you can run this to find which user are you.
    <?php
    passthru('whoami');
    ?>



    Nabil wrote: 
    Gal Guest

  3. #3

    Default Re: [PHP] exec shell command from php

    If you are using apache and php then when php runs the exec function
    then it is running the the user/group of the apache process.

    Here is what I might suggest doing. Have a registration form that
    submits the user's information to another process that logs the
    information (make sure to validate all information that is recieved).
    Then have a cron job or something that runs as root process the valid
    user requests and creates the accounts for you outside of apache and
    then sends and email notification to the user stating that the account
    has been set up. Then provide a link to activate that account. If the
    account is not activated within a desired account then that account
    needs to be deleted immediately.

    These is just something off the top of my head. There needs to be tons
    of time put into this and planned out or your box will become a hackers
    haven.

    --
    Ray


    On Wed, 2003-10-01 at 09:54, Nabil wrote: 
    Ray Guest

  4. #4

    Default Re: [PHP] exec shell command from php

    Did you read my message on sudo?
    This is how it gets done, so RTFM -
    http://www.courtesan.com/sudo/man/sudo.html

    Nabil wrote:
     
    Marek Guest

  5. #5

    Default Re: [PHP] exec shell command from php

    Hi,

    Thursday, October 2, 2003, 1:54:38 AM, you wrote:
    N> hi all;

    N> - When i run php.. what user am i using ? is it apache user (nobody) ??
    N> - How can i execute useradd command from php ? should i write it in
    N> pearl/cgi ??
    N> - I want to grant my user on my web a free pop account (or webmail) so i
    N> need to create an user with bin/false so he has no shell login but pop login
    N> ... how can i do this by php.. as exec('useradd ...
    N> couldn't be done only by root ..... what user should i do ? what solution ..
    N> i googled for virtual popuser .. and i didn't manage .. so i decided to do
    N> it this way
    N> any comment ?


    You are better using something like vpopmail that creates virtual accounts
    without the need for system accounts.
    http://www.inter7.com/vpopmail.html needs qmail but the other mail systems can
    do similar things and not need system accounts.

    --
    regards,
    Tom
    Tom Guest

Similar Threads

  1. Replies: 1
    Last Post: September 23rd, 11:51 AM
  2. Replies: 1
    Last Post: September 23rd, 02:11 AM
  3. [PHP] How to get exec() to display output from UNIX Shell Environemnt?
    By Reuben D. Budiardja in forum PHP Development
    Replies: 1
    Last Post: August 5th, 09:41 PM
  4. executing multiple shell commands via one exec()-call
    By Falk Schneider in forum PHP Development
    Replies: 1
    Last Post: July 15th, 06:20 AM
  5. note 33671 added to function.shell-exec
    By cdinh3@csc.com in forum PHP Notes
    Replies: 1
    Last Post: July 3rd, 03:19 PM

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