SSH: Getting result as command not found

0 votes
asked May 30, 2011 by jepoy (450 points)
edited May 31, 2011

Hello Guys,

I wonder why am I getting "sh: site: command not found" when i run the following code?

' create an Ssh object
Dim ssh As Ssh = New Ssh()

Dim privateKey As New SshPrivateKey(_PrivateKeyFileLocation, _Password)

' connect to the server
ssh.Connect(_AkamaiHostName, _Port)

' login to the server
ssh.Login(_AkamaiUploadUserName, privateKey)
Dim shell As Shell = ssh.StartCommand("site az2z")

' get the response of the command
Dim response As String = shell.ReadAll()

'write the response
Console.Write(response)

' disconnect from the server
ssh.Disconnect()

1 Answer

+1 vote
answered May 30, 2011 by Lukas Matyska (40,360 points)
edited May 31, 2011

The "sh: site: command not found" message is the error message of the remote shell (remote SSH shell you are connected using the ssh.Connect(_AkamaiHostName, _Port) call).

It tells you the remote shell doesn't know the SITE command. The SITE command is one of the FTP command, but you are connected to an SSH server.

To learn about differences between FTP/FTPS/SFTP/SSH please visit our knowledge base article.

commented May 30, 2011 by jepoy (450 points)
edited May 30, 2011

oh so you're saying that FTP command cannot be executed using SSH? :)

commented May 30, 2011 by Lukas Matyska (40,360 points)
edited May 30, 2011

Exactly, FTP and SSH are two different protocols. To know which commands are available on your SSH server, please connect to your server using the PuTTY client and give it a try.

commented May 31, 2011 by jepoy (450 points)
edited May 31, 2011

thank you... I will give it a try and what you said makes a lot of sense to me too :) i do really appreciate your help thanks matyska.

...