Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to run a simple shell command on a remote linux machine using executeprocess in NiFi

Solved Go to solution
Highlighted

How to run a simple shell command on a remote linux machine using executeprocess in NiFi

We have configured password-less ssh onto our edge node. From one of my NiFi instance, I am able to ssh into the edge node by using this simple command

ssh username@edge-node-hostname

When i try this similar command using execute process. I am running into error.

error : "host key verification failed"

error : "Pseudo-Terminal will not be allocated because stdin is not a terminal"

error : No Such file or directory.

these are the arguments, which i have passed in the executeProcess, Let me know where I am doing wrong. Any documentation related to this with example will also help.

Command : sh

command arguments : ssh username@edge-node-hostname

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to run a simple shell command on a remote linux machine using executeprocess in NiFi

Contributor

@subash sharma The error messages you are seeing shows some issues with ssh configurations.

  • error : "host key verification failed"

This error message shows that the ssh client is not able to verify 'edge-node-hostname'. It is possible that the entry for 'edge-node-hostname' is not available in the known_hosts file located in the home directory of the user you are running NiFi as. If you are running NiFi as root, check the known_hosts file in /root/.ssh/known_hosts. And if NiFi is running as a non-root user, check the '.ssh/known_hosts' files in the home directory of that user.

You can also run the following command which would then ask you for a confirmation in yes/no input format to add the entry of the 'edge-node-hostname' in the known_hosts file.

sudo -u <NiFi_user> ssh username@edge-node-hostname
  • error : "Pseudo-Terminal will not be allocated because stdin is not a terminal"

This error message is because you are just trying to obtain a remote shell in the executeProcess processor which is not possible. You can either add a command to be run after ssh succeeds or you can add -t -t arguments to ssh command which should help.

 ssh username@edge-node-hostname date

OR

ssh -t -t username@edge-node-hostname

View solution in original post

1 REPLY 1
Highlighted

Re: How to run a simple shell command on a remote linux machine using executeprocess in NiFi

Contributor

@subash sharma The error messages you are seeing shows some issues with ssh configurations.

  • error : "host key verification failed"

This error message shows that the ssh client is not able to verify 'edge-node-hostname'. It is possible that the entry for 'edge-node-hostname' is not available in the known_hosts file located in the home directory of the user you are running NiFi as. If you are running NiFi as root, check the known_hosts file in /root/.ssh/known_hosts. And if NiFi is running as a non-root user, check the '.ssh/known_hosts' files in the home directory of that user.

You can also run the following command which would then ask you for a confirmation in yes/no input format to add the entry of the 'edge-node-hostname' in the known_hosts file.

sudo -u <NiFi_user> ssh username@edge-node-hostname
  • error : "Pseudo-Terminal will not be allocated because stdin is not a terminal"

This error message is because you are just trying to obtain a remote shell in the executeProcess processor which is not possible. You can either add a command to be run after ssh succeeds or you can add -t -t arguments to ssh command which should help.

 ssh username@edge-node-hostname date

OR

ssh -t -t username@edge-node-hostname

View solution in original post

Don't have an account?
Coming from Hortonworks? Activate your account here