home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dove!cme!libes
- From: libes@cme.nist.gov (Don Libes)
- Newsgroups: comp.unix.questions
- Subject: Re: FTP - macros and macdef
- Keywords: FTP Macro Macdef
- Message-ID: <20501@muffin.cme.nist.gov>
- Date: 30 Dec 92 04:59:54 GMT
- References: <1992Dec22.202855.20553@magnus.acs.ohio-state.edu> <1h86neINN25f@early-bird.think.com>
- Organization: National Institute of Standards and Technology
- Lines: 36
-
- In article <1h86neINN25f@early-bird.think.com> barmar@think.com (Barry Margolin) writes:
- >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..
- }The next problem is that the argument to the "ftp" command is a host name,...
- }A third problem is that "$" is a special character to the shell. The...
-
- }>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.
-
- Write an Expect script. You can check for errors, prevent ^C from
- interrupting it, and hide any disgusting parts of the ftp dialogue at
- the same time.
-