How to impersonate webserver process

I have this scenario:
I have a MacMini Server Late 2012 with several virtual machines using Parallels 9.  Parallels comes with a command line utility called "prlctl" that allows me to start, stop, suspend, resume any virtual machine.
I am trying to create a webpage that allows remote users to:
1) See a list of all available VMs with its status (online, stopped, suspended, active)
2) Start/Resume an specific VM
3) Stop/Suspend an specific VM
To do this I am using:
1) OSX bultin webserver
2) PHP
I created a simple PHP page to test the viability of my idea:
$out = array();
exec("prlctl list -a", $out, $r);
echo "<pre>";
for ($i=0; $i<count($out); $i++) echo "<br>".$out[$i];
echo "</pre>";
but when I access the page all I got is this:
UUID                                    STATUS       IP_ADDR         NAME
when I run that same command from command line I got:
UUID                                    STATUS       IP_ADDR         NAME
{d33828f3-326d-4e5b-9c22-9d85b86869e6}  running      -               tmicl.cwy.qas
{f91412b0-d75c-4e52-827f-3a9b7f11b140}  running      -               tmicl.dmo.prd
{895bc08f-a2e5-454d-97f8-f25b06720e55}  running      -               tmicl.pet.qas
{02c8adcc-f21a-461c-beb6-ba6ae17b1bdd}  running      -               tmicl.sql.qas
As far as I can see, the problem is caused by the user under witch the command is being executed.  When executed from the PHP page, the _www user is used and this user seems to have no access to the Parallels Service.  When ran from the command line, it ran under my local user and therefore I get the expected result.
Because of this, I need a way to impersonate the webserver process but ONLY for an specific virtual directory.  Is there a way to accomplish this, maybe using a .htaccess file ?
TIA
Victor Espina

I just found the solution following this post:
1) Added this lines to sudoers file:
myuser ALL=(ALL) NOPASSWD: /usr/bin/prlctl
_www ALL=(ALL) NOPASSWD: /usr/bin/prlcl 
2) The EXEC() command in PHP was changed to:
exec("sudo -u myuser prlctl list -a", $out, $r);
The basic trick is to allow your user (and the _www user) to run the specific command by sudo.
Victor Espina

Similar Messages

  • How to impersonate user in 10G

    Hi Team,
    How to impersonate the user if the user A will login into the webserver i want to know the details of that user A for which objects he as accessed in his session.How can we achieve this one.
    Thanks,

    Easy approach would be using URL parameters
    0) If you are logged into BI application then log-out.
    1) go to URL as following parameters.
    http://servername/analytics/saw.dll?Dashboard?impersonate=target_user_name
    2) Provide Super User(How as presentation Admin access typically Administrator user) credentials on logon screen.
    3) You will be logged in as TAREGET_USER.
    Second approach implement proxy user feature.
    http://santoshbidw.wordpress.com/2010/11/14/act-as-proxy-user-obiee-10g/

  • How to do parallel processing with dynamic internal table

    Hi All,
    I need to implement parallel processing that involves dynamically created internal tables. I tried doing so using RFC function modules (using starting new task and other such methods) but didn't get success this requires RFC enabled function modules and at the same time RFC enabled function modules do not allow generic data type (STANDARD TABLE) which is needed for passing dynamic internal tables. My exact requirement is as follows:
    1. I've large chunk of data in two internal tables, one of them is formed dynamically and hence it's structure is not known at the time of coding.
    2. This data has to be processed together to generate another internal table, whose structure is pre-defined. But this data processing is taking very long time as the number of records are close to a million.
    3. I need to divide the dynamic internal table into (say) 1000 records each and pass to a function module and submit it to run in another task. Many such tasks will be executed in parallel.
    4. The function module running in parallel can insert the processed data into a database table and the main program can access it from there.
    Unfortunately, due to the limitation of not allowing generic data types in RFC, I'm unable to do this. Does anyone has any idea how to implement parallel processing using dynamic internal tables in these type of conditions.
    Any help will be highly appreciated.
    Thanks and regards,
    Ashin

    try the below code...
      DATA: w_subrc TYPE sy-subrc.
      DATA: w_infty(5) TYPE  c.
      data: w_string type string.
      FIELD-SYMBOLS: <f1> TYPE table.
      FIELD-SYMBOLS: <f1_wa> TYPE ANY.
      DATA: ref_tab TYPE REF TO data.
      CONCATENATE 'P' infty INTO w_infty.
      CREATE DATA ref_tab TYPE STANDARD TABLE OF (w_infty).
      ASSIGN ref_tab->* TO <f1>.
    * Create dynamic work area
      CREATE DATA ref_tab TYPE (w_infty).
      ASSIGN ref_tab->* TO <f1_wa>.
      IF begda IS INITIAL.
        begda = '18000101'.
      ENDIF.
      IF endda IS INITIAL.
        endda = '99991231'.
      ENDIF.
      CALL FUNCTION 'HR_READ_INFOTYPE'
        EXPORTING
          pernr           = pernr
          infty           = infty
          begda           = '18000101'
          endda           = '99991231'
        IMPORTING
          subrc           = w_subrc
        TABLES
          infty_tab       = <f1>
        EXCEPTIONS
          infty_not_found = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
        subrc = w_subrc.
      ELSE.
      ENDIF.

  • How to call BPEL process in JSP page

    Hi
    I am new to BPEL.please help me how to call BPEL process in JSP page.
    Thank You...

    Check this thread ....
    How can i call asyncronous BPEL process from Java Class????
    Tom..

  • How to configure quality process with batch management.

    Dear Friends,
                we have a scenario,our client receive goods with 101movement type  into quality inspection stock.
    once stock is passed quality check stock,then we will take into unrestricted stock with 321 movement type.
    failed in quality test will  be rejected.please give me suggestion how to map the scenario.while i am testing
    the process in my sandbox,its asking batch number.its not allowing me to post unrestricted stock with 321
    movement type.how to make batch as optional in this scenario?if batch is mainted for the material,how to
    configure the process.we are not using QM module.
    please suggest me.
    Regards,
    Varun

    In Batch management config in Logistic general, Check for the movement type 101 & 321 whether batch creation has been activated to Manual, Automatic, or no creation. In your case it looks like for mvt 321 batch creation is set to manual & for 101 no creation.
    if batch creation is set to manual, enter a manual batch no & proceed.
    But to cross verify wheter 101 has generated batch or not please check the stocks in MMBE.
    Hope this helps.
    Regards
    Mithun

  • How does the GR processing time affect the scheduling of the process order & the latest start date in the operation.

    Hi
    Can anyone explain  how does the GR processing time affect the scheduling of the process order & the latest start date in the operation overview.

    Hi
    GR processing time means number of workdays required after receiving the material in storage.
    Check this link:GR Processing time
    Regards,
    Anupam Sharma

  • How much ram and processing power in my imac will meet my graphic design needs?

    Hi,
    I'm in the market for a new imac. I'm trying to figure out how much ram I'll need and which processor will be sufficient for my graphic design needs.
    I'm gonna need it to be robust enough to have InDesign, Photoshop, and Illustrator open at once along with spotify, safari with many tabs open, and a couple other apps including evernote and game from time to time. Also, I'm gonna be managing a good deal of fonts in font explorer. How much ram and processing power will I need in my imac to keep everything snappy with all these apps going at the same time?
    Any advice on this would be much appreciated. Feel free to include any other relevant information you think I should know.
    Thanks, Nick

    Computers are out of date when you open the box
    Ok, getting serious, that iMac should be a viable workhorse for what you want for a good five years, and taht depends on how much ram you put in it, add really fast external storage, and so on.
    Didn't throw this in earlier so as to not influence the discussion: my daughter is the senior art director, VP, at a graphics design firm in NYC.  Has been in the business for a number of years.  When she changed out her Mac at work, bought, or company bought, the 27" iMac model just before the latest, with maxed out CPU/GPU, and storage.  They maxed the memory to 32 GB for her, then added a 30" Apple cinema display so she has almost 5' of display in front of her.  There is nothing she cannot have open all spread across that display area.  She works almost exclusively in print media, occassionally condescends to do web stuff.  And has a massive array of RAID drives hanging on it.  But that is a setup an individual would be hard pressed to go with.
    At home she uses a MacBook Pro with top cpu and display but that is all.
    The point, just how massive do you want to go depends on how fast you have to work; in the office where time is money you need tons of horsepower.  At home, you scale it to your abilitty to juggle other tasks at the same time.
    I think your choices have been great, the discussion has focused on what is important and especially what can and cannot be changed in the future.
    Best of luck setting this up.

  • HOW TO STOP THE PROCESS CHAIN WHICH IS RUNNING IN THE PRODUCTION?

    HI ALL,
    CAN ANYONE TELL ME HOW TO STOP THE PROCESS CHAIN WHICH IS RUNNING DAILY AT 5.00 PM. I NEED TO STOP THE PROCESS CHAIN FOR COUPLE OF DAYS AND THEN RESTART IT AGAIN.
    cAN ANYONE TELL ME THE PROCEDURE TO STOP THE ENTIRE PROCESS CHAIN RUNNING IN THE PRODUCTION.
    THANKS
    HARITHA

    Hi,
    First and foremost let me advice you to be very careful while doing this.
    For Rescheduling
    RSPC> chain > Goto > Planning view and
    click on Execution tab > select > Remove from Schedule and then in Maintain variant of start process reschedule for the day you require it to run.
    For terminating active chain
    You can start from SM37, find the process WID/PID then go to SM50 or SM51 and kill it. Once its done come back to RSMO and check the request, it should be red but again manually force to red and save by clicking on the total status button in the status tab. This shuld ensure that the process is killed properly.
    The next step will be to go to targets that you were loading and remove the red requests from those targets.
    Note: For source system loads you may have to check if the request is running in the source system and kill if needed and pull it again.
    But for BW datamart delta loads u may have reset the datamarts in case u are going to pull the delta again.
    Re: Kill a Job
    Re: Killing a process chain.
    Regards,
    JituK

  • How to stop the process chain showing status as yellow but no process step

    Dear Friends,
    How to stop the process chain showing status as yellow but no process step is running in that process chain.
    We have manually triggered the process chain for sales it finished successfully till load data but the next step is create index and DB statistics. Both of this steps are in unscheduled position only and no background job for this.
    Please guide me.
    Thanking you in advance.
    Regards,
    Shubhangi

    Hi,
      At times even I have faced this situation.  During those times, running the Function module RSPC_PROCESS_FINISH by passing the right parameters came to my rescue.
    Regards,
    Raj

  • How to get the process id of a sql statement or a session  ....

    How to get the process id of a sql statement or a session . ..?
    Thanks

    What about this?
    SELECT pid
      FROM v$session s, v$process p
    WHERE p.addr = s.paddr
       AND s.sid = :sid;   -- replace :sid with your session idRegards.
    Al

  • How to run a process flow in recovery mode

    Hi,
    I have 10 Mappings in a Process Flow. While executing that process flow, All of sudden It got errored out at 5th mapping.
    Please explain me how to run the process flow again from the 5th mapping( which got errored out in the previos run)....i.e I do not want to run the first 4 mappings in that process flow again, I want to run only the remaining mappings in the process flow.
    Please let me know in case you need more information / explaination.
    Thanks in advance...

    Hi
    On the question of process flows and resuming the following article gives some ideas, it has to be designed in the process flow basically;
    http://www.rittmanmead.com/2008/05/resuming-your-etl-process-in-owb/
    The article describes some ideas and techniques for tracking success/failure of flows and restarting.
    Cheers
    David

  • How to monitor RFC processing in XI

    Hi Friends,
    In the IDoc to RFC scenario please tell me How to monitor RFC processing in XI..
    Thanks and Regards
    Sri

    Sri,
      You can monitor in SXI_MONITOR/SXMB_MONI. If its Syncronous then u can see the request and response messages in the above mentioned transaction.
      To get more details you can go for RWB and select ur message and check for audit log's.
    Best regards,
    raj.

  • How to Integrate HCM Process with Webdynpro ABAP Application

    hi,
    I have issue regarding how to integrate HCM Process with Webdynpro abap application.
    I had created one HCM process for transfer using Hrasr_dt T code and also created form scenario and work flow.
    How to Integrate HCM Process with Webdynpro ABAP Application
    by
    Parthasarathi

    hi suhasini,
    Thanks for your reply,
    Can u explain in detail.. and Give any documents or links...
    by
    Parthasarathi

  • How to move the process chain from Unassigned node to a new node in 3.5?

    Hi all,
    I have created a new process chain in the development and it is falling under the Unassigned nodes. I want to move that process chain to an another node. but i am unable to do that
    Can anyone let me know how to move the process chain from unassigned node. I have drag and dropped but still the same in BW 3.5 ?
    Thanks
    Poooja

    Hello,
    Try this....
    Double click on your process chain. Via the menu select:
    Process chain > Attributes > Display components
    Select F4 (possible entries)
    At the bottom of the window you will find a create icon
    to make your own component.
    After you created it, assign it to your process chain.
    Don't forget to save the process chain.
    Regards,
    Sivaram

  • How-to trigger a process chain using ABAP?

    Does anybody know how to trigger a process chain using ABAP code?
    Any help would be appreciated!
    Thanks
    Ioan

    Hi Ioan,
    try this in your ABAP:
        CALL FUNCTION 'BP_EVENT_RAISE'
          EXPORTING
            eventid         = 'Your Event'
            eventparm       = 'START'
            target_instance = ' '
          EXCEPTIONS
            OTHERS          = 01.
    and schedule your process chain, waiting for 'Your Event'.
    regards
    Siggi

Maybe you are looking for

  • How do I stop background audio clips from playing while browsing sites?

    Firefox is my default browser. I use Google chrome and Internet explorer sessions for background monitoring news site sessions at the same time. I have no problem with the other two browsers. While surfing with Firefox I get unwanted background audio

  • OIM 11g r2 Exchange connector provisioning is not working

    Hi, I have created one user in oim and i have provisioned this user into AD successfully. after that i have tried provision same user into Exchange but the user provisioning status is shows "*waiting*" and provision date also shows wrong. Please any

  • Adobe Media Encoder - not encoding entire video

    Hi, I'm runining CS4 Design Premium on a Windows XP machine. I'm trying to convert an .avi to .flv, but Adobe Media Encoder is only converting the first few minutes of the video. Is there a file size limit for the source media? My .avi is pretty huge

  • Who's who - add custom selection parameter

    Hi, I want to add a custom selection parameter to the who's who in ESS. I've copied the standard infoset to a z-one, added siome output-fields and this works well. But now I want to add a selection-parameter which is not included in the ldb pncp (tex

  • How to read the selection conditions entered in Srch help in srch help exit

    Hi Experts, I have created a search help to get the list of Change Numbers from table AENR. It is based on Creation date, Created by, Description and Reason. Is there any way by which after the user enters text in Description and Reason fields as a s