Reply
Expert Contributor
Posts: 109
Registered: ‎05-19-2016

shell action in oozie

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 [1]

 

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?

Highlighted
Posts: 1,903
Kudos: 435
Solutions: 307
Registered: ‎07-31-2013

Re: shell action in oozie

Could you show us your sudo configuration? Does it declare NOPASSWD for all commands?

Also, since you're using a shell script, keep in mind that it would run in a YARN container and may therefore execute as either the 'yarn' user (in un-secure environments) or the job submitting user (in secure environments). The sudo command would therefore be executed as that user.