Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Passing credentials through to exec command

Posted on 2005-05-03
Medium Priority
Last Modified: 2013-12-13
How can I pass user credentials (using integrated Windows authentication with IIS) through to a command which is being executed via exec()?  I am trying to write a simple web-based script which will sync files from our development server to production using robocopy.  The problem is that when I execute robocopy through exec(), it runs under the IIS user who doesn't have permissions to the production share.

I want the robocopy command to be executed under the credentials of whoever is logged in.  I have tried using runas and CPAU but neither worked (runas doesn't allow passwords to be passed in, and CPAU opens the command in another window so no output back to the php script).  Also, I do not want to modify permissions, or create any new users to accomplish.  The users who are logging in having the necessary permissions.

I appreciate any help.
Question by:fentoozler
  • 2
  • 2

Author Comment

ID: 13945445

Expert Comment

ID: 14024770
I don't think that's possible with how IIS does things.  You'll probably need to find another solution.  Does this absolutely have to work inside of PHP?

Author Comment

ID: 14029323
I would like it to work in PHP, but any other language would be acceptible as long as it stays web-based.

Accepted Solution

dougday earned 2000 total points
ID: 14030808
Web-based would be the problem.  The way that IIS is structured doesn't really allow for that kind of access.  Apache allows for a highler level of control over this sort of thing, but also falls a bit short.  The big reason behind this, of course, being security issues and concerns.  There might be some special way of doing it, but not that I'm aware of.  I would create a domain user for your IIS account and grant that user the necessary privileges to access the resources you need.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question