MarketplaceStudioActivityConnection to SSH Server

Create your first automation in just a few minutes.Try Studio Web

Connection to SSH Server

Connection to SSH Server

by Internal Labs

Star

4

Activity

Downloads

10.2k

Robert Stan
Posted 5 years ago

Hi,

I have succesfully connected to a switch using the SSHConnectScopeActivity. Inside the Run SSH Commands loop, I have a SSHRunCommandActivity with a variable as a result. Uder it, I have an IF statement which based on the previously result determine what to do. Inside the ELSE section, I have another SSHRunCommandActivity which returns the following error: Renci.SshNet.Common.SshConnectionException: Client not connected.

What I don't understand is why is the client not connected if the SSHRunCommandActivity is inside the loop of SSHConnectScopeActivity. Do you have any ideea?

Thanks in advance

EDIT: As for the update last day, I found out that every shell command using SSH RUN SHELL COMMAND activity, begins with "echo $" and for cisco switches this is a problem as i cannot activate the shell before the command. Any advice?

EDIT 2: Never mind, the problem was my regular expresion. After I changed from  "[a-zA-Z0-9_.-]*\#$" to "[a-zA-Z0-9_.-]*\#", everything worked. Thank you Sorin and keep up the good work! 

TIP for CISCO swithes: On "SSH Run Shell Command", turn Check Exit Code to False so the shell command will not error out when you run CLI IOS commands.

If you want to run ("true") shell commands, create inside the  SSH Connect Scope an SSH Run Shell Command with the Check Exit Code to False with the "term shell" command. Doing so you will be able to run shell commands in your cisco switch without problems using this activity.

Sorin Calin
Posted 5 years ago ago

Hi Robert!

I'm glad it worked out for you and thank you for the observations. If you need to debug it or adapt it, you can also find the code here:

https://github.com/sorincalin/UiPathTeam.SSHConnector.Activities

Thanks,

Sorin

Abhishek Aithal
Posted 5 years ago

Run command activity doesnt work when the command has white space in between

Sorin Calin
Posted 5 years ago ago

I've uploaded a new version which allows sending the commands through a Shell also. Please check if that solves your problem.

Ishan Pael
Posted 5 years ago

I am getting error

no suitable authentication method found to complete authentication. ssh.net

Sorin Calin
Posted 5 years ago ago

Hi. I don't know what it could be. You can find the code of the activities here and you are able to debug it in VS to understand what the issue could be:

https://github.com/sorincalin/UiPathTeam.SSHConnector.Activities

Thanks,

Sorin

Bhavna Ganesh
Posted 5 years ago

How do we disconnect the SSH session? Is there a way to reuse an existing connection using SSH variable?

Sorin Calin
Posted 5 years ago ago

Please read the user guide available in the Resources section. This is explained there.

tetheredyoke1 Mallett
Posted 5 years ago

I am trying to use this activity to connect to a switch.  I can login with the SSH Connect Scope.  I am now trying to figure out how to run the command "enable", and then type the password when prompted immediately after the enable command (in a switch you would type "enable" then enter the password and the "Password:" prompt).  When I use SSH Run Command, if I just have "enable", it will time out before running the next SSH Run command where I have the password as the command.  I cannot find a way to combine the "enable" and Password in the same SSH Run command, and so I'm stuck.  Any suggestions?  Thanks for any help.

Sorin Calin
Posted 5 years ago ago

Unfortunately not. You can try and debug using directly the code of this activities:

https://github.com/sorincalin/UiPathTeam.SSHConnector.Activities

Linking regular commands is usually possible with ";" between them, but I have not tried this with passwords.

Rapeepan Suwannakorn
Posted 5 years ago

Dear Sorin,

Thank you for your suggestion, I've already solved my problem. ^_______^

Sorin Calin
Posted 5 years ago ago

I'm happy to hear that.

Rapeepan Suwannakorn
Posted 5 years ago

Dear Sorin,

May I ask you some question about "Connection to SSH Server". I have problem when I use "SSH Connect Scope".

When I set timeout = 00:10:00 or System.TimeSpan.FromMinutes(10), I get error message as below

"Value for a required activity argument 'Timeout' was not supplied."

 Please suggest me, what is the value I should set to TIMEOUT.

Thank you so much

Rapeepan

Sorin Calin
Posted 5 years ago ago

TimeSpan.FromSeconds(10) or TimeSpan.FromMinutes(10) should work fine. Please double check you have input this correctly. If you still get errors, try to remove the activity and add it again in your workflow.

Rapeepan Suwannakorn
Posted 5 years ago

What is the value of Timeout(property) of SSH Connect Scope (Activity)?

I get Error Message after input value = 10 or 00:00:10:00

Sorin Calin
Posted 5 years ago ago

If you hover over a property of an activity you can see what is the type. In this case it is TimeSpan so you can use this: TimeSpan.FromSeconds(10)

Pradeep Kumar
Posted 6 years ago

Hi Sorin,

UseCase : i have to connect to RDP then open putty on RDP .

  1. I am able to launch putty on RDP and able to type username in the putty session , BUT i am not able to send password to putty session. How i can do this?

  2. I am not able to read a command output send in putty session. For example , i want to read output of ls command and store it some text file and further execute another command and read output and store it another text file and so on. How i can do this?

Sorin Calin
Posted 5 years ago ago

Hi Pradeep,

Sorry but I don't understand why would you use the component in question if you are connecting to the server using putty. The component I built is intended to be used to connect directly to a server while putty does exactly that as a desktop client.

If you want to investigate how the component is working, please feel free to use its code here:

https://github.com/sorincalin/UiPathTeam.SSHConnector.Activities

Best regards,

Sorin

Ezharul Hasan Ansari
Posted 6 years ago

The pbrun command lets you execute commands with the privileges of another user, typically the root user. The pbrun command uses PowerBroker, a centralized server application, for the authorization and auditing of commands run as the root user. We have given 3 min timeout but still not working.

Sorin Calin
Posted 5 years ago ago

Hi,

I'm afraid I don;t know the reason why that wouldn't work. The code of the component is here:

https://github.com/sorincalin/UiPathTeam.SSHConnector.Activities

Please feel free to debug using it and potentially adapt it to your needs.

Best regards,

Sorin

Ezharul Hasan Ansari
Posted 6 years ago

While using actviites simple commnad like PWD is returning the result but when tried for using command phrun su **** getting timeout error. Any idea what is the reason.

Sorin Calin
Posted 6 years ago ago

I am not aware of the phrun command, so I don't understand what you are tying to do. Timeout commands can probably mean that the expected command's output did not return in the allocated amount of time. You can increase the timeout of the command from the properties and see if it works better. Also, please refer to the GitHub repo where you can download the code and debug directly:

https://github.com/sorincalin/UiPathTeam.SSHConnector.Activities

Ranjani r
Posted 6 years ago

Hi Sorin,

I get below error intermittently on unattended bot. i'm unsure what's causing this error?

SSH Connect Scope' with ID 18 threw or propagated an exception while being canceled.

Sorin Calin
Posted 6 years ago ago

I haven;t experienced that error during the tests I performed with those activities. Please refer to the GitHub repo where you can download the code and debug directly:

https://github.com/sorincalin/UiPathTeam.SSHConnector.Activities

Publisher

Internal Labs

Visit publisher's page

License & Privacy

License Agreement

Privacy Terms

Technical

Version

2.1.2

Updated

January 9, 2024

Works with

Studio: 21.10 - 23.10

Certification

Silver Certified

Support

UiPath Community Support

Resources