home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.unix.questions
- Subject: Re: FTP - macros and macdef
- Date: 22 Dec 1992 23:01:02 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 45
- Message-ID: <1h86neINN25f@early-bird.think.com>
- References: <1992Dec22.202855.20553@magnus.acs.ohio-state.edu>
- NNTP-Posting-Host: telecaster.think.com
- Keywords: FTP Macro Macdef
-
- In article <1992Dec22.202855.20553@magnus.acs.ohio-state.edu> szatezal@magnus.acs.ohio-state.edu (Shane M Zatezalo) writes:
- >I wanted to use a macro with FTP, so that if I created a user,
- >and set his shell to "FTP $macroname"
- >it would run that macro, and then exit that macro (when it was done)
- >and log the user out.
-
- The login shell field of the passwd entry is the pathname of a program, not
- a shell command line. On many systems you can set it to the pathname of a
- shell script, so you can use a shell script that invokes ftp with the
- appropriate parameters.
-
- The next problem is that the argument to the "ftp" command is a host name,
- not an ftp command line or a macro file name.
-
- A third problem is that "$" is a special character to the shell. The
- commands that are documented in the ftp(1) man page are intended to be
- typed at the "ftp>" prompt. Macros are also intended to be defined
- interactively.
-
- >What I want the user to be able to do is this: on login, he
- >immediately is dropped into FTP so that he can GET one file
- >from my system, and only that one file, and can't do anything
- >else at all.
-
- Macros aren't useful for this; they're useful when you want to do a
- repetitive operation within a single ftp session. You want a script like:
-
- #!/bin/sh
- ftp hostname <<END
- username
- password
- bell
- ascii
- cd /foo/bar
- get it
- quit
- END
-
- I don't know how secure this is, though. I'm not sure what it will do if
- the user types ctl-C in the middle of it.
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-