-
Task
-
Resolution: Won't Fix
-
Major
-
None
-
Production
My task is to perform certain operations on Linux server as a sudo user.
Current Situation: Using the ssh pipeline plugin I am able to login into the remote server and run the command using sshCommand.
Issue: To perform other operations I need to switch to a sudo user with a password. I am unable to find if this is possible with this plugin.
Please refer to the below code and let us know you suggestions to the issue
def remote = [:] remote.name = '<server name>' remote.host = '<server host name>' remote.user = '<userId>' remote.password = '<password>' remote.allowAnyHosts = true remote.agent = true node { stage('Remote SSH') { sshCommand remote: remote, command: "ls lrt" Able to Execute the pipeline until here sshCommand remote: remote, command: "sudo su <sudo Username>",sudo: true — Not sure if this is the right usage } }