A brief introduction how you can run shell commands and shell scripts with ScriptRunner using OpenSSH.
If not already done, you have to install and config OpenSSH at your machines first.
When you are able to connect the target Linux host from your Windows host (e.g. the ScriptRunner Service Host) via SSH, you are ready to set up a ScriptRunner Action to run commands at the linux target from ScriptRunner.
-
Create a credential for the windows user, that should connect to the linux target.
-
Copy the Invoke-SSH.ps1 script to the ScriptRunner Script Repository. This repository is located in
%ProgramData%\ScriptRunner\ScriptMgr
. It is recommended to copy the script into a subfolder likeOpenSSH
. -
Create a ScriptRunner Action with the Invoke-SSH script. Use the target
PS Loopback Remoting
. Overwrite the target credentials with the previously created credential. -
Set up the script parameters
UserName
andRemoteHost
in the Action settings.
Now you should be able to run commands and scripts in the context of the user specified with the Parameter UserName
at the RemoteHost
from this ScriptRunner Action via SSH.