Problem with SSH Cmd Shell connection
Posted: Fri 04 Aug 2017 20:31
Hi,
I keep getting the "Storage is no set." pop-up. I don;t even know what this means as it doesn't seem to be a complete sentence. Here is my procedure:
What the heck am I over looking? The documentation doesn't seem to show enough about this. Do I need storage configured if I am passing in password and username in my procedure?
Please help!
I keep getting the "Storage is no set." pop-up. I don;t even know what this means as it doesn't seem to be a complete sentence. Here is my procedure:
Code: Select all
procedure TipiqControlForm1.sshclientCmd(CMD: String);
begin
TnetPanel.Visible := False;
SSHPanel.Visible := True;
SSHclient1 := TScSSHClient.Create(self);
ScSSHChannel1 := TScSSHChannel.Create(SSHclient1);
SSHClient1.HostName := HOST;
SSHClient1.Port := strtoint(PORT);
SSHClient1.User := USER;
SSHClient1.Password := PSWD;
SSHclient1.Connect;
ScSSHChannel1.Connect;
CMDShell := TScSSHShell.Create(self);
// This is probably redundant but here it is anyway:
CMDShell.Client.HostName := SSHClient1.HostName;
CMDShell.Client.Port := SSHClient1.Port;
CMDShell.Client.User := SSHClient1.User;
CMDShell.Client.Password := SSHClient1.Password;
if(not SSHClient1.Connected) then
messageDlg('NO SSH CONNECTION!',mtError, mbOKCancel, 0);
if SSHclient1.Connected then
begin
CMDShell.Connect;
sshConsole.Lines.Clear;
sshConsole.Lines.Add('READY FOR COMMANDS!');
if(CMD = 'daemon_restart') then
begin
CMDShell.WriteString('daemon_stop' + #13#10);
//SSH.ExecuteCommand('daemon_stop');
sleep(3000);
CMDShell.WriteString('daemon_start' + #13#10);
//SSH.ExecuteCommand('daemon_start');
end
else
begin
//SSH.WriteString(CMD);
CMDShell.ExecuteCommand(CMD);
end;
CMDShell.Disconnect;
SSHClient1.Disconnect;
end
else
sshConsole.Lines.Add('Cannot connect.');
SSHclient1.Destroy;
SSHclient1.Free;
end;
What the heck am I over looking? The documentation doesn't seem to show enough about this. Do I need storage configured if I am passing in password and username in my procedure?
Please help!