I am trying to execute a shell script from oozie. The script is used to download a file from a remote server using scp command.
The shell script looks like this:
sudo -u test scp userName@ServerIP:pathToFileONRemoteServer/export_all_products.csv /home/test
Now, I am using sudo - u test because password less ssh has been enabled for test user only. I came across error messages that suggested disabling tty and that's what I did for test user.
However, Now I get:
sudo: no tty present and no askpass program specified Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.ShellMain], exit code 
Why is that and how do we fix this? I am using hue and can't seem to enable password less ssh for hue user as it isn't a shell user and isn't a folder under with username under home directory.
Is there a way around this?
May I ask why you cannot simply run the oozie workflow as user test. yarn will use the linuxtaskcontroller to execute a script as the user who runs the oozie workflow. The shell action can be run on any datanode node so I don't assume you made sudo -u work passwordless on all datanodes.
Alternatively you can use the SSH action to execute a program on a specific node. ( then you need to allow the oozie user password less SSH to the user on the node who is running the workflow. ) In that case everything is completely as if you run the command locally for example on an edge node.
That's not the question. The point is where you run the scp command and as whom.
If you run shell it can be executed on any datanode. So all datanodes need to be able to run the command you put into there successfully and have access to your remote machine.
If you use ssh action you can force the execution of the scp command unto an edge node. Only that one then needs access to your remote server.