SSH connection from ASPNET to a unix server
jg.lalanne_at_gmail.com
Date: 06/14/05
- Next message: dl: "AD object properties update (set to nothing)"
- Previous message: Vinod: "Folder permission"
- Next in thread: jeangui: "Re: SSH connection from ASPNET to a unix server"
- Reply: jeangui: "Re: SSH connection from ASPNET to a unix server"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 14 Jun 2005 01:13:24 -0700
Hi,
I have developped a web service in C# .NET that has to launch a unix
script on a AIX machine. I have installed on my windows 2003 server the
cygwin environment with the ssh.exe utility.
I have created a RSA public key without passphrase and appended it in
the authorized_keys file on the unix server.
When I launch my C:\cygwin\bin\ssh.exe unixlogin@unixserverhost 'uname
-a' from a doc command prompt, it works correctly without asking me a
password.
I do the same with the following code from a C# console project, and it
works correctly as well :
_____________________________________________________
string commandText = "C:\\cygwin\\bin\\ssh.exe";
string argsText = "login@server 'uname -a'";
Process objProcess = new Process();
objProcess.StartInfo.FileName = commandText;
objProcess.StartInfo.Arguments = argsText;
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
objProcess.StartInfo.CreateNoWindow = false;
objProcess.StartInfo.RedirectStandardOutput = true;
objProcess.StartInfo.RedirectStandardError = true;
objProcess.StartInfo.UseShellExecute = false;
try
{
objProcess.Start();
objProcess.WaitForExit();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
string error = objProcess.StandardError.ReadToEnd();
string output = objProcess.StandardOutput.ReadToEnd();
Console.Out.WriteLine("output = " + output );
---------------------------------------------------------
When I put the same code in my Web Service, it does not work anymore.
This is, I supposed, because of the ASPNET profile that is different
from the window user profile used for the RSA key generation.
That was I tried to use the impersonation to force the good user
profile in my web service code. But it does not work either....
Does anyone of you manage to do such a SSH communication from ASPNET to
a unix server ?
Thanks in advance for your help.
Best Regards
Jean-Guillaume LALANNE
- Next message: dl: "AD object properties update (set to nothing)"
- Previous message: Vinod: "Folder permission"
- Next in thread: jeangui: "Re: SSH connection from ASPNET to a unix server"
- Reply: jeangui: "Re: SSH connection from ASPNET to a unix server"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|