Page 1 of 1

Job to connect to remote server using SSH

Posted: Mon Apr 23, 2012 11:51 pm
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

Posted: Tue Apr 24, 2012 12:59 am
by ray.wurlod
What (precise) error message is being logged?

Posted: Tue Apr 24, 2012 2:58 am
by mouniV
Hi Ray,

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

Thanks,
Mounika

Posted: Tue Apr 24, 2012 6:04 am
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?

Posted: Tue Apr 24, 2012 6:44 pm
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.

Posted: Tue Apr 24, 2012 7:10 pm
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

Posted: Wed Apr 25, 2012 10:53 pm
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

Posted: Wed Apr 25, 2012 11:18 pm
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

Posted: Thu Apr 26, 2012 6:45 am
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".

Posted: Thu Apr 26, 2012 9:50 am
by PaulVL
Cut and Paste what you are seeing.

Posted: Mon May 07, 2012 2:21 am
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

Posted: Mon May 07, 2012 5:00 am
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.

Posted: Mon May 07, 2012 6:29 am
by chulett
So... what was the resolution?

Posted: Wed May 09, 2012 11:58 pm
by mouniV
Hi All,

The keys were set up properly with the remote server and now we are able to connect without any issue.

Posted: Thu May 10, 2012 6:30 am
by chulett
Thank you... figured as much but wanted to confirm.