Operating System - HP-UX
1848876 Members
4077 Online
104038 Solutions
New Discussion

Re: telnet script doesn't on HP

 
Ridzuan Zakaria
Frequent Advisor

telnet script doesn't on HP

I am trying to telnet to remote host using
script. Currently the script works on my Solaris machine but I doesn't on my HP-UX 11.00 machine.

Here is the script:

( sleep 2
echo userid
sleep 2
echo password
sleep 5
echo ls
sleep 5
echo exit ) | telnet hostname

When I ran on HP, the telnet session terminated immediately after login prompt.

Here is the output:

*************************************
Trying 156.37.133.132...
Connected to Cstool10
Escape character is '^]'.



login: userid
Password: Connection closed by foreign host.

*********************************

I got the script for this forum, I suppose it should work on HP too.
quest for perfections
14 REPLIES 14
Sridhar Bhaskarla
Honored Contributor

Re: telnet script doesn't on HP

Change the second sleep value to 1 and try. Your script should work.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Ridzuan Zakaria
Frequent Advisor

Re: telnet script doesn't on HP

Sri,

Thanks for the reply, However it still doesn't.

One things thatI noticed the different between my Sun and HP server is that on Sun " Local flow control is OFF and HP is ON. Could this be the problem? If so how can I turn it off?


****************
SOLARIS
****************
Trying...
Connecte
Escape character is '^]'.
Local flow control off


SunOS 5.7
********************

******************
HP-UX
******************
Trying...
Connected to HPUX11.
Escape character is '^]'.
Local flow control on
Telnet TERMINAL-SPEED option ON
***************************

Thanks in advance
quest for perfections
Patrick Wallek
Honored Contributor

Re: telnet script doesn't on HP

I am not on my machine so I don't know if this will work or not, but you might give it a try:

telnet hostname << EOF
userid
password
pwd
ls
exit
EOF
Sridhar Bhaskarla
Honored Contributor

Re: telnet script doesn't on HP

I am quite surprized. Your script should work. Local flow control - it shouldn't matter. I am not able to duplicate the problem here. It shows local flow control on but works. Do you have another hp system and try if your script works there?. You might have already done but I would do the following

1. Run the script on a sun system connecting to the same HP system
2. Run the script on another HP system connectiong to the same HP system
2. Run the script on HP connecting a SUN system
3. Since it is failing after password, I will check the server to see if there are any bad attempts due to this.

Connection closed by foreign host means that it is not able to read from or write to the server. This message is given by your telnet session itself.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Ridzuan Zakaria
Frequent Advisor

Re: telnet script doesn't on HP

Hi Guys, Thanks for you reply.

I have noticed that the script is actually worked on some of my HP servers and not on others.

All the servers look the same to me. What else can I check or do to resolve the problem.

Is there any log file that I can check?
Is it something to do with security on some of the server.

I can establish the connect on all the server interactively.

Thanks in advance
quest for perfections
Sridhar Bhaskarla
Honored Contributor

Re: telnet script doesn't on HP

Hi Ridzuan,

As it is working on other HP systems, it is may be your tty settings that are causing the problem. I may be able to give a fix but you could try setting the .profile to default profile, execute the profile and then run this script. Else, you can copy the .profile from the system where the script is working and see if it fixes the problem

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Ridzuan Zakaria
Frequent Advisor

Re: telnet script doesn't on HP

Hi Sri,

I did ran tty command on those servers, return the following value either /dev/ttyp1 or /dev/ttyp2.

The script doesn't work on /dev/ttyp2 but for
/dev/ttyp1 some work and some don't.

stty command return the following result on all the servers :

speed 9600 baud; evenp hupcl
min = 0; erase = ^H;
eol2 = ^@;
susp = ^Z; dsusp = ^Y;
werase = ^@; lnext = ^V;
-inpck -istrip icrnl -ixany ixoff onlcr
-iexten echo echoe echok
-echoctl -echoke

I did copy .profile from working server to not working server but still am not be able to connect to those not O.K servers.

Any help is appreciated.

Thanks in advance
quest for perfections
linuxfan
Honored Contributor

Re: telnet script doesn't on HP

Hi Ridzuan,

On the machines where you are having a problem, can you login manually? Do you see any errors in /var/adm/syslog/syslog.log (looking for telnetd errors basically)?

-Regards
I am RU
They think they know but don't. At least I know I don't know - Socrates
Ridzuan Zakaria
Frequent Advisor

Re: telnet script doesn't on HP

Hi RU,

I can connect to all HP servers manually.

Any suggestion is greatly appreciated.

Thanks
quest for perfections
IST_1
New Member

Re: telnet script doesn't on HP


Hi,

I have a similar problem on an HP server (HP-UX 11.00) (assume SRV1)

In fact, I have a Sun workstation from which I can connect with telnet on SRV1.
But when I connect (telnet) on another HP server (assume SRV2) and from it, try to connect with telnet on the orginal machine (SRV1), it outputs as following:

login : user
Password: Connection closed by foreign host

If anyone have some elements or experience about this problem, il would be nice

Best regards




Michael Salazar
New Member

Re: telnet script doesn't on HP

This patch will fix your login from a script problem, PHNE_26051.
bruce bai
New Member

Re: telnet script doesn't on HP

Hi, Ridzuan,
I have exact same problem on HPUX 11. Glad to see these talks. But I can't get it work on mine. Have got it work on all of your HPs? May I have a copy of your best working script? please send to bbai@hbfgroup.com? I appreciate greatly.
bruceb
Misa
Frequent Advisor

Re: telnet script doesn't on HP

Something's nagging at me that my answer's wrong, but I'll suggest anyway -- does the user's login environment have something in it that's causing an immediate logout? (i.e., an exit statement in a .login or .profile, etc)

--Misa
bruce bai
New Member

Re: telnet script doesn't on HP

thanks, Misa. There is no eixt kind of statement in my user environment. And I can telnet mannualy. Did found a post talking about differences in .profile/.login on Solaris and C shells. Not know the solution. Can anyone help?