in reply to Hiding passwords in scripts

Try and avoid storing your password in a file. It is better to just prompt the user ...
use Term::ReadKey; use DBI; . . . print "Enter password for $user:\n"; ReadMode 2; chomp($passwd = ReadLine(0)); ReadMode 0; # Reset tty mode my $dbh = DBI->connect("DBI:mysql:database=$db;host=$server", $user, $ +passwd);
What reason do you have for putting a password in your scripts?

Plankton: 1% Evil, 99% Hot Gas.

Replies are listed 'Best First'.
Re^2: Hiding passwords in scripts
by SpanishInquisition (Pilgrim) on Sep 29, 2004 at 20:04 UTC
    That's not a good solution for batch apps, mod_perl pages, daemons, and all sorts of other stuff. It's best to just configure the database to use something else, and to have it all work automagically. Most newer databases are cool enough to use other security mechanisms, making password just a step up from "security = totally off".
      Sure it is, just fork your script off into the background after someone has enter the password.