VMware Cloud Community
Camberton
Enthusiast
Enthusiast

Workflow run SSH command - PATH

Hi,

I'm trying to use the SSH plugin to execute a command.

But when the command is running, the environnent variables (PATH) are by default and i want to set different to execute specific commands.

I tried to use "session.addEnvironment" but no effect.

Tried to use "export PATH=$PATH:paths....." in the "executeCommand" but no effect.

Is there a way to configure specific variable environnement ?

Best regards

1 Reply
mr_bib
Contributor
Contributor

I know this is a very old post, but it's the only post I found in the whole world I think about this topic!

I've just spent a good chunk of time trying to figure this out, so for the benefit of future Googlers, you need to configure the "AllowEnv" parameter in sshd_config on the remote server.

For example, if you add the following to the end of /etc/ssh/sshd_config:

Match User vro

     AllowEnv VRO_*

...then if you use session.addEnvironment("VRO_TESTVAR", ... then the "VRO_TESTVAR" will be passed to the SSH session of the "vro" user.

Hope that helps someone else in the future!

D