Re: How can I tell openssh client to prompt for a username
From: Derek Martin (code_at_pizzashack.org)
Date: Wed, 14 Jul 2004 03:49:40 +0900 To: firstname.lastname@example.org
On Fri, Jul 09, 2004 at 11:24:04PM +0200, Jan-Benedict Glaw wrote:
> > Write a small shell script wrapper around it. For example (untested!):
> > #!/bin/bash
> Bad habit alert. Don't requite /bin/bash if /bin/sh could run the script
> as well. You'll love that if you ever need to copy that script to a host
> on which no bash is installed...
It's actually a lot worse than that. Invoking the script as /bin/bash
will cause the shell (i.e. the script) to read the user's ~/.bashrc
and/or ~/.profile, etc. This is almost certainly NOT what you want.
For example, if this script is invoked by the user's .bashrc file,
then it may result in an infinite loop which spawns many processes,
tying up system resources, and preventing the user from actually being
able to log in. For some time, the implementation of the "which"
command included with Debian stable suffered from this problem.
Other possible problems include the possibility that the .bashrc file
sets some variable that plays havoc with other processes. For
example, maybe it sets LD_PRELOAD or some similar variable, causing
things to be all out of whack. Basically, if you're writing a shell
script to be used on a system-wide (rather than personal) basis, NEVER
EVER EVER EVER EVER invoke a shell script as #!/bin/bash -- it can
result in strange and hard to debug problems.
-- Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0x81CFE75D
- application/pgp-signature attachment: stored