home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / question / 15047 < prev    next >
Encoding:
Internet Message Format  |  1992-12-30  |  1.7 KB

  1. Path: sparky!uunet!dove!cme!libes
  2. From: libes@cme.nist.gov (Don Libes)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: FTP - macros and macdef
  5. Keywords: FTP Macro Macdef
  6. Message-ID: <20501@muffin.cme.nist.gov>
  7. Date: 30 Dec 92 04:59:54 GMT
  8. References: <1992Dec22.202855.20553@magnus.acs.ohio-state.edu> <1h86neINN25f@early-bird.think.com>
  9. Organization: National Institute of Standards and Technology
  10. Lines: 36
  11.  
  12. In article <1h86neINN25f@early-bird.think.com> barmar@think.com (Barry Margolin) writes:
  13. >In article <1992Dec22.202855.20553@magnus.acs.ohio-state.edu> szatezal@magnus.acs.ohio-state.edu (Shane M Zatezalo) writes:
  14. }>I wanted to use a macro with FTP, so that if I created a user,
  15. }>and set his shell to "FTP $macroname"
  16. }>it would run that macro, and then exit that macro (when it was done)
  17. }>and log the user out.
  18.  
  19. }The login shell field of the passwd entry is the pathname of a program, not..
  20. }The next problem is that the argument to the "ftp" command is a host name,...
  21. }A third problem is that "$" is a special character to the shell.  The...
  22.  
  23. }>What I want the user to be able to do is this: on login, he 
  24. }>immediately is dropped into FTP so that he can GET one file
  25. }>from my system, and only that one file, and can't do anything
  26. }>else at all.
  27. }
  28. }Macros aren't useful for this; they're useful when you want to do a
  29. }repetitive operation within a single ftp session.  You want a script like:
  30. }
  31. }#!/bin/sh
  32. }ftp hostname <<END
  33. }username
  34. }password
  35. }bell
  36. }ascii
  37. }cd /foo/bar
  38. }get it
  39. }quit
  40. }END
  41. }
  42. }I don't know how secure this is, though.  I'm not sure what it will do if
  43. }the user types ctl-C in the middle of it.
  44.  
  45. Write an Expect script.  You can check for errors, prevent ^C from
  46. interrupting it, and hide any disgusting parts of the ftp dialogue at
  47. the same time.
  48.