zsh-users
 help / color / mirror / code / Atom feed
* Suggestions for auto-login script for ZSH?
@ 1996-11-25 19:08 Kosh
  1996-11-25 19:47 ` Timothy Luoma
  1996-11-25 21:01 ` Richard Coleman
  0 siblings, 2 replies; 8+ messages in thread
From: Kosh @ 1996-11-25 19:08 UTC (permalink / raw)
  To: zsh-users

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: TEXT/PLAIN; charset=US-ASCII, Size: 984 bytes --]

Greetings fellow ZSH users,

I'm trying to write a script that would allow be to make telnet login (or
ftp login) processes automated.  Here's what I tried:

#!/home/u1/mariah/bin/zsh
telnet host.com
echo 'loginname'
echo 'password'



This didn't work (as well as variants of the above example)...  It telnets
okay, but that's it. When I quit the telnet, THEN it echo's the thing I
want to echo.  Is it possible to write a script like this with zsh?  As
far as FTP, I would like to write something that will automate the
following steps:

1. ftp
2. login
3. password
4. get a particular file
5. exit :)

I would appriciate any assistance or suggestions in this matter.
Thanks in advance! :)

--
 Sirius Bontea, E-3
-=ðUnited States Air Forceð=-
Email:   <mariah@isis.interpac.net>
Web page:   http://home.interpac.net/~mariah/index.html
IRC:  ]{osh@EfNet  on  #Mariah  =)
Administrator of the Mariah Carey Marketplace.
==== For more details,  'finger mariah@isis.interpac.net' ====


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Suggestions for auto-login script for ZSH?
  1996-11-25 19:08 Suggestions for auto-login script for ZSH? Kosh
@ 1996-11-25 19:47 ` Timothy Luoma
  1996-11-25 20:20   ` Domenico Galli
  1996-11-25 21:01 ` Richard Coleman
  1 sibling, 1 reply; 8+ messages in thread
From: Timothy Luoma @ 1996-11-25 19:47 UTC (permalink / raw)
  To: Kosh; +Cc: zsh-users


this is not a ZSH thing, this is a shell thing in general

you are looking for the program "expect" from Don Libes which uses TCL to
automate login processes.

of course, rather than using 'telnet' you could use an .rhosts file and
use rlogin....

ftp to ftp.cme.nist.gov and goto pub/expect

TjL



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Suggestions for auto-login script for ZSH?
  1996-11-25 19:47 ` Timothy Luoma
@ 1996-11-25 20:20   ` Domenico Galli
  0 siblings, 0 replies; 8+ messages in thread
From: Domenico Galli @ 1996-11-25 20:20 UTC (permalink / raw)
  To: zsh-users; +Cc: Kosh

For ftp you may try something like this:

ftp -n > ftp.log <<-EOF
   open hostname
   user username password
   cd dirname
   ascii
   get filename
   quit
EOF

Of course this is not safe, because you write your password in a file. 
It's better to use rcp instead of ftp and rlogin instead of telnet.

Domenico Galli

On Mon, 25 Nov 1996, Timothy Luoma wrote:

> 
> this is not a ZSH thing, this is a shell thing in general
> 
> you are looking for the program "expect" from Don Libes which uses TCL to
> automate login processes.
> 
> of course, rather than using 'telnet' you could use an .rhosts file and
> use rlogin....
> 
> ftp to ftp.cme.nist.gov and goto pub/expect
> 
> TjL
> 
> 
> 


-------------------------------------------------------------------------------
Domenico GALLI
Dipartimento di Fisica dell'Universita' di Bologna and INFN, Sezione di Bologna
via Irnerio, 46, I-40126 Bologna - ITALY
Phone:  (+39) 51 351027                Fax:    (+39) 51 244380
e-mail: galli@bo.infn.it
-
CERN PPE LR 22 R-006, Route de Meyrin, CH-1211 Geneve 23, Switzerland
Phone:  (+41) 22 767 2166        (+41) 22 767 8259        (+41) 22 767 6609
e-mail: domenico.galli@cern.ch
-
DESY, GEB. 66, ZI. 6, Notkestrasse, 85, 22607 Hamburg, Germany
Phone:  (+49) 40 8998 4545
e-mail: galli@hera-b.desy.de
-------------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Suggestions for auto-login script for ZSH?
  1996-11-25 19:08 Suggestions for auto-login script for ZSH? Kosh
  1996-11-25 19:47 ` Timothy Luoma
@ 1996-11-25 21:01 ` Richard Coleman
  1996-11-25 21:52   ` Jose Unpingco
  1996-11-25 21:57   ` Nate Johnston
  1 sibling, 2 replies; 8+ messages in thread
From: Richard Coleman @ 1996-11-25 21:01 UTC (permalink / raw)
  To: zsh-users

> I'm trying to write a script that would allow be to make telnet login (or
> ftp login) processes automated.  Here's what I tried:
> 
> #!/home/u1/mariah/bin/zsh
> telnet host.com
> echo 'loginname'
> echo 'password'
> 
> 1. ftp
> 2. login
> 3. password
> 4. get a particular file
> 5. exit :)

The problem is that the login process reads the tty directly,
when getting the password.  No amount of shell redirection can
get around this.

The best solution is to retrieve the program "expect" which is
a tcl extension.  It allow you to automate many things which are
generally interactive, such as rlogin/telnet, changing passwords,
ftping, etc...  It is easy to build

I would also recommend Don Libe's book "Exploring Expect" from
O'Reilly.  It is an excellent book.

Check out the expect home page at:

http://elib.cme.nist.gov:80/pub/expect/

rc


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Suggestions for auto-login script for ZSH?
  1996-11-25 21:01 ` Richard Coleman
@ 1996-11-25 21:52   ` Jose Unpingco
  1996-11-25 21:57   ` Nate Johnston
  1 sibling, 0 replies; 8+ messages in thread
From: Jose Unpingco @ 1996-11-25 21:52 UTC (permalink / raw)
  To: Richard Coleman; +Cc: zsh


FYI, the correct URL is

ftp://ftp.cme.nist.gov/pub/expect/index.html


I think that other one is outdated.

Richard Coleman said:
> 
> Check out the expect home page at:
> 
> http://elib.cme.nist.gov:80/pub/expect/
> 
> rc


-- 
Thank you for your time and consideration.  

             _ - - - _                             
           /)-  - _     _                          
          / |_o_/  -       _        
              \__  -          _        
                \ \_              -   _  _  _  _   _  _  _  _  _       
                 _                      
   __ __ _ _  -        
Jose Unpingco                                Mail Code ECE 0407
HM# (619) 622-1243                           WK# (619) 534-5809


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Suggestions for auto-login script for ZSH?
  1996-11-25 21:01 ` Richard Coleman
  1996-11-25 21:52   ` Jose Unpingco
@ 1996-11-25 21:57   ` Nate Johnston
  1996-11-25 22:34     ` Greg Badros
  1 sibling, 1 reply; 8+ messages in thread
From: Nate Johnston @ 1996-11-25 21:57 UTC (permalink / raw)
  To: ZSH Users

On Mon, 25 Nov 1996, Richard Coleman wrote:

> > I'm trying to write a script that would allow be to make telnet login (or
> > ftp login) processes automated.  Here's what I tried:
> > 
> > 1. ftp
> > 2. login
> > 3. password
> > 4. get a particular file
> > 5. exit :)
> 
> The problem is that the login process reads the tty directly,
> when getting the password.  No amount of shell redirection can
> get around this.


Actually, I have found that this is not true.  For example, this works
perfectly fine for me:

echo "ftp mywhateverhost
$LOGNAME
mypassword
bin
get flotsam.tar
bye" > .tmpfile
telnet myloginhost < .tmpfile > ftp.log

I have seen this used to telnet to port 22 on a random host to sonnect to
sendmail and spoof one's return address. 

For this man, however, that there is a mechanism already created to
do what he needs.  Look up the man page on the .netrc file.  It specifies
this sort of information for ftp depending on the hostname - quite
convenient, and better than this method.  

                                            --N.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Suggestions for auto-login script for ZSH?
  1996-11-25 21:57   ` Nate Johnston
@ 1996-11-25 22:34     ` Greg Badros
  1996-11-26  3:55       ` I. Dwayne Koonce
  0 siblings, 1 reply; 8+ messages in thread
From: Greg Badros @ 1996-11-25 22:34 UTC (permalink / raw)
  To: Nate Johnston; +Cc: ZSH Users

On Mon, 25 Nov 1996, Nate Johnston wrote:

> Actually, I have found that this is not true.  For example, this works
> perfectly fine for me:
> 
> echo "ftp mywhateverhost
> $LOGNAME
> mypassword
> bin
> get flotsam.tar
> bye" > .tmpfile
> telnet myloginhost < .tmpfile > ftp.log

And this could be better written using HERE documents as

telnet myloginhost <<END_OF_SCRIPT > ftp.log
ftp mywhateverhost
$LOGNAME
mypassword
bin
get flotsam.tar
bye
END_OF_SCRIPT

But it's a bad idea to have passwords in scripts, or as plaintext
anywhere (like in .netrc).

Greg J. Badros                 8816 Nesbit Ave N., Apt 303
gjb@cs.washington.edu          Seattle, WA  98103-4067
http://www.cs.washington.edu/homes/gjb



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Suggestions for auto-login script for ZSH?
  1996-11-25 22:34     ` Greg Badros
@ 1996-11-26  3:55       ` I. Dwayne Koonce
  0 siblings, 0 replies; 8+ messages in thread
From: I. Dwayne Koonce @ 1996-11-26  3:55 UTC (permalink / raw)
  To: ZSH Users

On Mon, 25 Nov 1996, Greg Badros wrote:

> On Mon, 25 Nov 1996, Nate Johnston wrote:
> 
> > Actually, I have found that this is not true.  For example, this works
> > perfectly fine for me:
> > 
> > echo "ftp mywhateverhost
> > $LOGNAME
> > mypassword
> > bin
> > get flotsam.tar
> > bye" > .tmpfile
> > telnet myloginhost < .tmpfile > ftp.log
> 
> And this could be better written using HERE documents as
> 
> telnet myloginhost <<END_OF_SCRIPT > ftp.log
> ftp mywhateverhost
> $LOGNAME
> mypassword
> bin
> get flotsam.tar
> bye
> END_OF_SCRIPT
> 
> But it's a bad idea to have passwords in scripts, or as plaintext
> anywhere (like in .netrc).

Not necessarily; what I used to used to use my .netrc for was automating
logins to anonymous ftp servers, where you password is your e-mail
address, and not exactly sensitive information :)  But if you use ftp very
much, I highly recommend installing ncftp, which you can find on
ftp.probe.net, in /pub/ncftp.  It automatically maintains the equivalent
of a .netrc (although it doesn't record passwords for non-anonymous sites
:).

For hosts that you have an account on, you can create a .rhosts file
(caution:  this can be a security risk; RTFM before trying).  This will
allow you to retrieve files with rcp, and login automatically with rlogin.

____________________________________________________________________________
I. Dwayne Koonce                                   E-mail:  idk@metronet.com
____________________________________________________________________________
"It's dangerous to be right when the government is wrong."  --Voltaire


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1996-11-26  4:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-25 19:08 Suggestions for auto-login script for ZSH? Kosh
1996-11-25 19:47 ` Timothy Luoma
1996-11-25 20:20   ` Domenico Galli
1996-11-25 21:01 ` Richard Coleman
1996-11-25 21:52   ` Jose Unpingco
1996-11-25 21:57   ` Nate Johnston
1996-11-25 22:34     ` Greg Badros
1996-11-26  3:55       ` I. Dwayne Koonce

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).