Running DOS Commands with Unix UNC Paths from Within ASP

Running DOS Commands with Unix UNC Paths from Within ASP

am 03.04.2008 07:16:00 von Support

I hope this is the right place for this quesiton.
I have the following ASP page that simply executes a DIR command on a UNC
path and displays the results. When the UNC path is a Windows machine the
output is as expected however when the UNC path is a Unix machine running
Samba, nothing is returned. I've configured the Authentication Method for the
IIS web site to use an account that has permissions to both the Windows and
Unix shares and confirmed this is the case by logging into the IIS server via
RDP as this account and running the command from a DOS window, which works
fine for both the Windows and Unix shares. The Samba server is configured to
authenticate against the same domain as the IIS and File share servers.

I don't believe there is a permissions problem and instead there is some
wierd interaction between the CMD.EXE instance created by the ASP page and
Unix server running Samba.

<%
Set objShell = CreateObject("WScript.Shell")
Set objExec = objShell.Exec("cmd /c dir \\server\share")
Set objStdOut = objExec.StdOut
strOutput = objStdOut.ReadAll
Response.Write strOutput
%>

Re: Running DOS Commands with Unix UNC Paths from Within ASP

am 04.04.2008 10:42:51 von David Wang

On Apr 2, 10:16=A0pm, Anonymous
wrote:
> I hope this is the right place for this quesiton.
> I have the following ASP page that simply executes a DIR command on a UNC
> path and displays the results. When the UNC path is a Windows machine the
> output is as expected however when the UNC path is a Unix machine running
> Samba, nothing is returned. I've configured the Authentication Method for =
the
> IIS web site to use an account that has permissions to both the Windows an=
d
> Unix shares and confirmed this is the case by logging into the IIS server =
via
> RDP as this account and running the command from a DOS window, which works=

> fine for both the Windows and Unix shares. The Samba server is configured =
to
> authenticate against the same domain as the IIS and File share servers.
>
> I don't believe there is a permissions problem and instead there is some
> wierd interaction between the CMD.EXE instance created by the ASP page and=

> Unix server running Samba.
>
> <%
> =A0 =A0 =A0Set objShell =3D CreateObject("WScript.Shell")
> =A0 =A0 =A0Set objExec =3D objShell.Exec("cmd /c dir \\server\share")
> =A0 =A0 =A0Set objStdOut =3D objExec.StdOut
> =A0 =A0 =A0strOutput =3D objStdOut.ReadAll
> =A0 =A0 =A0Response.Write strOutput
> %>


You postulate a weird interaction that does not quite make sense.
CMD.EXE and DIR do not even know about Samba and UNC -- it's all
abstracted away in with the exact same Win32 API.

I still think it is some sort of permission issue because logging in
via RDP is not the same as authenticating via IIS. For example, if the
Samba server's ACLs are for Interactive logon then it would match for
RDP login but fail via IIS.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//