Operating System - HP-UX
1833758 Members
2917 Online
110063 Solutions
New Discussion

Re: hi, passing information to telnet

 
harikrishna
Advisor

hi, passing information to telnet

is there any method to pass tha username and password to telnet command and do the oprations like..

ftp -n << EOF
open
user < pass word>
..............
COMMANDS
................
EOF

THANKING YOU.
HARI KRISHNA
8 REPLIES 8
Chris Wilshaw
Honored Contributor

Re: hi, passing information to telnet

You can use the utility "expect".

Download it from the HP Porting Centre

http://hpux.connect.org.uk/
harikrishna
Advisor

Re: hi, passing information to telnet

hi my ,
problem is to write a script that connected to the mail server from my system and to execute the script which is in mailserver.

THANKING YOU
Elmar P. Kolkman
Honored Contributor

Re: hi, passing information to telnet

Seems to me you're better of using ssh or remsh. That way you can configure it to connect to the other side without ever sending a password over the network.

Every problem has at least one solution. Only some solutions are harder to find.
Cheryl Griffin
Honored Contributor

Re: hi, passing information to telnet

ITRC Knowledge Base document KBRC00001309 shows how to execute ftp in a shell script.
"Downtime is a Crime."
Mark Grant
Honored Contributor

Re: hi, passing information to telnet

I'm with Elmar on this one.

"remsh hostname command" is the simplest form assuming there is a .rhosts file on the host you are connecting to in the home directory of the user you are connecting to that has the source hostname in it.

remsh is less secure than ssh and shouldn't be used where the network is untrusted. "ssh" on the other had, is more secure but a bit more difficult to get it to not require a password (at least it is for me because I've never done it).
Never preceed any demonstration with anything more predictive than "watch this"
Vijaya Kumar_3
Respected Contributor

Re: hi, passing information to telnet

Hi Hari,

As Chris Said already Use "Expect" (It is a small scripting language like shell and it is available for almost all unix falvors).

Expect script is used to automate interactive command based utilities like, telnet , ftp, rlogin etc.

It can be embedded with Shell script too.

-Vijay
Known is a drop, unknown is ocean - visit me at http://vijay.theunixplace.com
T G Manikandan
Honored Contributor

Re: hi, passing information to telnet

why don't you assign some points to the people who are helping you!!
Geoff Wild
Honored Contributor

Re: hi, passing information to telnet

As others have said - you can use expect or rsh.

If it's just ftp, you can do it with .netrc file.

For the user that executes your ftp script, create a .netrc file in the home dir with the permissions 400, owner them:sys

In the file you put:

machine ip.of.remote.machine login loginid password thepassword

Then in your script, remove the
user < pass word>
line.


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.