ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

Error when Run Command Action is added "sudo -S -p" in the beginning of the command formation


Article ID: 226526


Updated On:


CA Automic Workload Automation - Automation Engine


Error when Run Command Action is added  "sudo -S -p" in the beginning of the command formation.When the user provides the command it gets appended to "sudo -S -p".

The Expected behavior is to work fine until the user provides sudo in his input which is when the final command contains two sudo in it and it gives the error.

For example when user provides command "pwd" or "ls -ltr" the command formation woluld look like this - "sudo -S -p pwd" and it works fine, but when the user gives sudo in his input the command formation looks like this - "sudo -S -p sudo -i -u ncqadm -S env | grep SECUDIR" which is why it fails




Release : 12.3.X



There are two workarounds that can be followed for this issue, Kindly check below.

Workaround 1:

There is a workaround for this issue that we can use as follows.
1 Create a file containing all the specified commands.
2. Use "PUT_FILE" action to transfer the file to target machine.
3. Use "RUN_COMMAND" action to execute the above file using SUDO.

Workaround 2:

Save the output of the "sudo -i -u" command to a temporary file, then read it as the current user.


Fix is under progress from sustaining engineering team.