The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Disconnecting a telnet session cooldude UNIX for Dummies Questions & Answers 14 12-09-2007 08:21 PM
Telnet Session to AIX bluebee UNIX for Dummies Questions & Answers 1 08-07-2007 03:19 PM
Unix Telnet session mlucas UNIX for Dummies Questions & Answers 2 08-17-2006 10:26 AM
Telnet session does not expire deepsteptom Shell Programming and Scripting 1 08-03-2004 11:48 AM
telnet session timeout yls177 UNIX for Dummies Questions & Answers 6 10-16-2002 09:11 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-06-2005
pathanjalireddy pathanjalireddy is offline
Registered User
  
 

Join Date: Apr 2005
Posts: 21
Exclamation Telnet Session

{
sleep 2
echo "$user"
sleep 2
echo "$password"
sleep 2
echo " ls"
sleep 10
echo "exit"
}| telnet $server


I have a machine x and i have executed the above script on machine 'x'.
i entered the appropriate user and password in the script and gave the ipaddress of the server in telnet $server.

When i executed this script on machine x, telnet started to another machine, took the user name and password and got logged in. It then executed the "ls" and "exit" commands from the script.

But i removed the exit command and executed the script, I got the prompt on the other machine, but i am not able to execute any commands and the prompt hangs.

HELP ME OUT !!!!!!!!!!!!!!!!!!!!
  #2 (permalink)  
Old 04-06-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
your script --- not stdin --- is supplying input to the telnet process so it hangs when you take the exit comand out as telnet is waiting for more input ...
  #3 (permalink)  
Old 04-06-2005
pathanjalireddy pathanjalireddy is offline
Registered User
  
 

Join Date: Apr 2005
Posts: 21
Exclamation Reply with code

Quote:
Originally Posted by Just Ice
your script --- not stdin --- is supplying input to the telnet process so it hangs when you take the exit comand out as telnet is waiting for more input ...
Please reply me with the modified code if possible !!!!!!!!!
  #4 (permalink)  
Old 04-06-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
what is the purpose of this script? is this just to help you login without putting in your password? if so, try rlogin (see "man rlogin") or ssh (see man "ssh") ...
  #5 (permalink)  
Old 04-06-2005
pathanjalireddy pathanjalireddy is offline
Registered User
  
 

Join Date: Apr 2005
Posts: 21
Purpose of this Script

Hi,

This is the purpose of this script.


Everyday, many times i need to log on to a local unix machine first, then use telnet to connect to remote unix machine using the desired username and password.

What my idea is whenever i execute a shell script(contains the ipaddress of remote machine, username, password) on a local unix machine, it gets connected automatically. May be the purpose is not worth but just got eager to know whether it can be done or not.

Thanks in advance if you can post the code or modify the script i have sent.
  #6 (permalink)  
Old 04-06-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
somebody else might be able to modify your code to do what you want but i think that is a big waste of time as you can definitely use rlogin or ssh to what you need ... good luck!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0