Facing_problem_with_ssh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Facing_problem_with_ssh
# 1  
Old 05-18-2015
Facing_problem_with_ssh

Hi,

I was facing problem with ssh, using ksh,AIX

trying to connect remote server in shell script, connection was successful but not able to exit from the remote server.please help

Code:
ssh username@hostaddress<<-ENDSSH
nohup ./execfile1 &
nohup ./execfile2 &
nohup ./execfile3 &
sleep 5
exit
ENDSSH

Code:
ssh username@hostaddress<<-ENDSSH
nohup ./execfile1 &
nohup ./execfile2 &
nohup ./execfile3 &
sleep 5
logout
ENDSSH

while i tried to use logout and exit before
Code:
ENDSSH

but no use.
got error as you are login user with
Code:
logout

i didnt displays any thing to STDOUTPUT when using
Code:
exit

.

please point to solve my problem where am i wrong.
# 2  
Old 05-18-2015
Try without logout and exit.
# 3  
Old 05-18-2015
Hi

Thanks for the response, already tried but to no use.
# 4  
Old 05-18-2015
which version of sshd on AIX side do you have?
can you post the output of "lsuser username" and .profile/.kshrc of the user from AIX?
# 5  
Old 05-18-2015
Quote:
Originally Posted by venky.b5
Code:
ssh username@hostaddress<<-ENDSSH
nohup ./execfile1 &
nohup ./execfile2 &
nohup ./execfile3 &
sleep 5
exit
ENDSSH

This may or may not help with your problem, but: when using ssh as stand-in for the classical rexec you principally should add a -o BatchMode=yes to the call. Otherwise, when the exchanged key pair gets invalid somehow, you might end with a ssh-process asking for your password (and halting the surrounding script).

What might also be the problem here is that the processes you call in "execfile" (which i would give a full path in your place, but that just as an aside) grab a terminal. Try adding "-n" to the ssh-call (see the man page for ssh for details).

I hope this helps.

bakunin
# 6  
Old 05-19-2015
Hi,

Agent.kgb

please find the o/p of lsuser username

Code:
venkat id=206 pgrp=venkatesh groups=venkatesh home=/apps/venkat shell=/usr/bin/ksh roles=

ssh version
Code:
OpenSSH_5.0p1, OpenSSL 0.9.8k 25 Mar 2009

Hi Bakunin,

Thanks for your response, i haven't made my ssh connection password less
i want script to prompt for the password so i think i cant use -n option and with -o option i am not able to connect to remote host.

Code:
ssh username@hostaddress<<-ENDSSH
cd /full/path/to/exec/files/;
nohup ./execfile1 &
nohup ./execfile2 &
nohup ./execfile3 &
sleep 5
exit
ENDSSH

thanks in advance
venkat
# 7  
Old 05-19-2015
Quote:
Originally Posted by venky.b5
i want script to prompt for the password so i think i cant use -n option
These two things have nothing to do with each other. Please read the man page for ssh: -n controls the allocation/non-allocation of a pseudo-terminal (stdin/stdout for the processes called within the ssh-session).

Regarding the "-o": i thought your ssh-line was part of a script and surrounded by other commands. My bad.

I hope that helps.

bakunin
This User Gave Thanks to bakunin For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question