Hello!
I want to pass environment variables without using ChannelExec#setEnv methods. Instead, I want to pass them in a single line to sh shell as below:
channelExec.setCommand("/bin/sh -c 'ENV1=val1 ENV2=val2 command'");
It works; but it creates another shell. I don't want to create another shell and replace the current shell used by SSH server. I did as below:
channelExec.setCommand("exec /bin/sh -c 'ENV1=val1 ENV2=val2 command'");
It works.
I want to be sure that replacing default shells of any SSH servers are a supported way.
is there any risk replacing SSH servers' defult shell ?
Thanks in advance!
Log in to post a comment.
Hello!
I want to pass environment variables without using ChannelExec#setEnv methods. Instead, I want to pass them in a single line to sh shell as below:
channelExec.setCommand("/bin/sh -c 'ENV1=val1 ENV2=val2 command'");
It works; but it creates another shell. I don't want to create another shell and replace the current shell used by SSH server. I did as below:
channelExec.setCommand("exec /bin/sh -c 'ENV1=val1 ENV2=val2 command'");
It works.
I want to be sure that replacing default shells of any SSH servers are a supported way.
is there any risk replacing SSH servers' defult shell ?
Thanks in advance!