can we telnet the system using shell script
code to telnet the system and pass user name and password through shell script.. is it possible?
it can be done using expect.. is it possible through shell script |
Hi,
This are 2 ways of doing it: 1) using a HERE document Code:
telnet some.site.com <<-HERE 2) Echoing to telnet Code:
{ |
I dont thing we can pass the password and login through telnet ( even if this is possible, I guess its not a very good idea at all !) The only way we can do this is by using .netrc file in $HOME/.netrc.
The format of a .netrc file Code:
machine xxx.x.com |
how to do with .netrc file.. what all i have to do
|
Hi,
@Libu: I don't have telnet (client/sserver) installed, so I could not try it out, but it works for sql/ftp including the user/password part (on the other hand it does not for ssh). I do agree that telnet is unsave and shouldn't be used, but that was not the question the OP asked :) And even a .netrc file is unsave. The .netrc solution you (Libu) gave is an elegant way of doing it. Although I don't know if it'll work for telnet, never tried. It does for ftp, that's for sure. |
how to create this file it does not reside in home
|
Hi,
Use you fav editor and create it: vi ~/.netrc fill it with the appropriate commands (machine xxx.x.com, login xxx, password xxxxx) each on its own line. Hope this helps. |
how to run it.. does it do the file transfer and how ?
what is the complete procedure? |
.netrc is for ftp only and doesn't apply to telnet (as far as I know).
There's a .telnetrc file, but not suitable to pass credentials You should use rlogin/rsh instead, or better ssh which all allow non-interactive login. |
can i ftp a system through some gateway
|
Yes, you can ftp to a system through either an http or a socks proxy.
PS: You should have better started another thread as this last question has nothing to do with the initial one. |
Oops, yes the .netrc was for ftp and not telnet :(. I overlooked that. Sorry for wasting your time.
As for telnet, using expect is the only answer that I can think off ! Dont know of anyother way, you can automate logging to another machine through telnet. |
i want to write the script which would first telnet the gateway from local system and then from gateway will do the ftp on other system
|
Forget telnet and ftp.
Code:
ssh gateway scp othersystem:/somefile /somedir |
i dint get it..
how to do? |
All times are GMT -5. The time now is 03:51 PM. |