Hi,

I believe this is the same issue asked on StackOverflow [1]. It was resolved to the poster’s satisfaction there, but I’m providing the same answer here for anyone on the list. 

"Have you tried using the -f or -d options for sshpass? They allow you to read the password from a file or file descriptor respectively. This way you can use OS-level access controls to restrict access to the file rather than having the password in an environment variable which other users or processes may be able to access it.

I can investigate further why the executed process apparently did not have access to the environment variable value if those options are not sufficient."


[1] http://stackoverflow.com/a/39843104/70465

Andy LoPresto
alopresto@apache.org
alopresto.apache@gmail.com
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

On Oct 3, 2016, at 2:00 PM, raghav130593 <raghav130593@gmail.com> wrote:

I am trying to run a remote script through a script in my host environment
from the ExecuteProcess processor in NiFi. Basically, the shell script in
the host server has the ssh string to the remote server and calling the
script in that remote server. I used sshpass package where I saved the
password in an environment variable(SSHPASS) and passed that in the ssh
string.For more info on sshpass, https://linux.die.net/man/1/sshpass . The
host script content is as follows:

sshpass -e ssh user@host sh /path-to-script


When I passed the host script path to the command property of the
ExecuteProcess processor, the result of the processor showed that it didn't
login to the remote server. So, after some debugging, I created a user
defined property in the processor that specified the environment variable
SSHPASS and its value which is the password of the remote server and then it
worked.

I exported the password as an environment variable in the host so that I
don't have to pass it as cleartext in the first place. Is there any
workaround where I don't have to specify the environment variable value ?
Any suggestions on any other method to connect to the remote server and call
the script is welcome too.



--
View this message in context: http://apache-nifi-developer-list.39713.n7.nabble.com/ExecuteProcess-fails-to-identify-environment-variable-in-the-script-tp13516.html
Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.