[CLUE-Tech] Bash and password entry

Dave Anselmi anselmi at americanisp.net
Sun Mar 24 18:52:27 MST 2002


Matt Gushee wrote:

> Hi, all--
>
> I was wondering how you can handle password entry in a shell script.
> I was thinking about writing a script that would synchronize certain
> directories on 2 hosts, using scp ... obviously it would be nice not
> to have to enter a password/passphrase for each file copied, but I
> don't know how (or if) I could store a password in a variable and
> reuse it.

Does -B to scp help?  The man page isn't specific.

Depending on your requirements, you can get the password to stick around in
memory for various periods and scopes, I think.  Maybe even without writing
any C ;-)  That's what ssh-agent does using a unix socket.  A fifo might
work too.

To keep a password around across boots, you're stuck with putting it on
disk.  Maybe you have some nvram you could use (in your CMOS or something),
but that is only a level of indirection.

I guess that if a machine is safe enough to keep your password for you, you
can just put it on disk (protected by filesystem permissions).  If it isn't
safe enough for that, it isn't safe to do anything but prompt when it's
needed.

Dave





More information about the clue-tech mailing list