Job to connect to remote server using SSH

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
mouniV
Participant
Posts: 9
Joined: Thu Jan 05, 2012 3:14 am

Job to connect to remote server using SSH

Post by mouniV »

Hi,

I need to connect to a remote server through SSH through datastage job. I am trying to use execute command stage and the script i am giving is ssh <server_name> ; <user_name>
keys are established between the 2 servers.

But the job is failing.

Can some one help me with the script I have to give and if this is possible using any other stage apart from execute command stage.

Thanks,
Mounika
Mounika V
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What (precise) error message is being logged?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mouniV
Participant
Posts: 9
Joined: Thu Jan 05, 2012 3:14 am

Post by mouniV »

Hi Ray,

ssh usename@servername did not finish ok. is the warning that i am getting.

Thanks,
Mounika
Mounika V
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

All that means is your script did not return success, a zero status. What else are you doing in the script besides this ssh command? Have you tried adding any debugging statements to it?
-craig

"You can never have too many knives" -- Logan Nine Fingers
PaulVL
Premium Member
Premium Member
Posts: 1315
Joined: Fri Dec 17, 2010 4:36 pm

Post by PaulVL »

Can you simplify the process by writing something like this:


ssh user@host "hostname";

break it down to testing the ssh connection and seeing if you can get there.

Then you can test the script/command you want to execute.
chrisjones
Participant
Posts: 194
Joined: Thu May 11, 2006 9:42 am

Post by chrisjones »

Might be Keys not setup properly.

Did you try to connect from unix to remote server before connecting from datastage?

Execute the below syntax on unix and if there is error or prompting for password then fix the key issues else you are good with key setup.

ssh userid@remote server name
Thanks,
Chris Jones
mouniV
Participant
Posts: 9
Joined: Thu Jan 05, 2012 3:14 am

Post by mouniV »

Hi All,

Thanks for the replies.

I have tried ssh username@servername.
I am not doing any debugging.
Even then i am getting the same error. May be the key is not set properly. If key is not set, cant we login using ssh username/password@servername?

Thanks,
Mounika
Mounika V
mouniV
Participant
Posts: 9
Joined: Thu Jan 05, 2012 3:14 am

Post by mouniV »

Hi All,
I was able to provide the password at command line and was able to establish connection. But, after connecting to remote server, it is asking for some user id. I am trying with that. THe command i have used is ssh username@servername --password='password'

Thanks,,
Mounika
Mounika V
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK... just for grins, clarify something. Are you executing an actual script in the Execute Command stage or not? It almost sounds like all you have in the stage is just the "ssh" command but that would make zero sense. What are you trying to accomplish? You need to ssh to a remote server and then what? :?

If you are running that ssh from the command line using the same credentials as the job and it prompts for the password, then you don't have the RSA keys / credentials setup correctly. And you won't be able to pass the password on the command line as that would make it not... "secure".
-craig

"You can never have too many knives" -- Logan Nine Fingers
PaulVL
Premium Member
Premium Member
Posts: 1315
Joined: Fri Dec 17, 2010 4:36 pm

Post by PaulVL »

Cut and Paste what you are seeing.
mouniV
Participant
Posts: 9
Joined: Thu Jan 05, 2012 3:14 am

Post by mouniV »

Hi All,

Sorry for the late reply.
I am providing the server name, user name and password as well along with ssh.
How ever even while connecting manually, i need to provide the user id , apart from teh connection id and password i use for login.

RSA was not set up properly. So, we are trying to provide password while doing ssh.

Thanks,
Mounika
Mounika V
PaulVL
Premium Member
Premium Member
Posts: 1315
Joined: Fri Dec 17, 2010 4:36 pm

Post by PaulVL »

a password should never be required for an ssh connection.

that's why you were asked to manually validate the key.

If you got prompted for a password, then you have key issues.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So... what was the resolution?
-craig

"You can never have too many knives" -- Logan Nine Fingers
mouniV
Participant
Posts: 9
Joined: Thu Jan 05, 2012 3:14 am

Post by mouniV »

Hi All,

The keys were set up properly with the remote server and now we are able to connect without any issue.
Mounika V
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Thank you... figured as much but wanted to confirm.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply