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

  1. Path: sparky!uunet!think.com!barmar
  2. From: barmar@think.com (Barry Margolin)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: FTP - macros and macdef
  5. Date: 22 Dec 1992 23:01:02 GMT
  6. Organization: Thinking Machines Corporation, Cambridge MA, USA
  7. Lines: 45
  8. Message-ID: <1h86neINN25f@early-bird.think.com>
  9. References: <1992Dec22.202855.20553@magnus.acs.ohio-state.edu>
  10. NNTP-Posting-Host: telecaster.think.com
  11. Keywords: FTP Macro Macdef
  12.  
  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. a shell command line.  On many systems you can set it to the pathname of a
  21. shell script, so you can use a shell script that invokes ftp with the
  22. appropriate parameters.
  23.  
  24. The next problem is that the argument to the "ftp" command is a host name,
  25. not an ftp command line or a macro file name.
  26.  
  27. A third problem is that "$" is a special character to the shell.  The
  28. commands that are documented in the ftp(1) man page are intended to be
  29. typed at the "ftp>" prompt.  Macros are also intended to be defined
  30. interactively.
  31.  
  32. >What I want the user to be able to do is this: on login, he 
  33. >immediately is dropped into FTP so that he can GET one file
  34. >from my system, and only that one file, and can't do anything
  35. >else at all.
  36.  
  37. Macros aren't useful for this; they're useful when you want to do a
  38. repetitive operation within a single ftp session.  You want a script like:
  39.  
  40. #!/bin/sh
  41. ftp hostname <<END
  42. username
  43. password
  44. bell
  45. ascii
  46. cd /foo/bar
  47. get it
  48. quit
  49. END
  50.  
  51. I don't know how secure this is, though.  I'm not sure what it will do if
  52. the user types ctl-C in the middle of it.
  53. -- 
  54. Barry Margolin
  55. System Manager, Thinking Machines Corp.
  56.  
  57. barmar@think.com          {uunet,harvard}!think!barmar
  58.