From: "Benjamin R. Haskell" <zsh@benizi.com>
To: Julien Nicoulaud <julien.nicoulaud@gmail.com>
Cc: Mikael Magnusson <mikachu@gmail.com>, zsh-users <zsh-users@zsh.org>
Subject: Re: Commands with passwords as options
Date: Tue, 1 Feb 2011 17:40:01 -0500 (EST) [thread overview]
Message-ID: <alpine.LNX.2.01.1102011726120.2792@hp> (raw)
In-Reply-To: <AANLkTikajPjd=r1CSrZnPCLnNFMS-y7KX1TKskQVvv1X@mail.gmail.com>
On Tue, 1 Feb 2011, Julien Nicoulaud wrote:
> OK, but at least it is hidden from the shell "UI". Take it as
> "man-looking-over-your shoulder" protection :-) For example you show
> something to someone, you do a backward history search and a command
> with a clear text password you forgot to exclude from history pops
> out...
In general, just avoid ever using such options. But, if you get lazy,
two ways around it that I use:
# method 1, use a var:
$ read DBPASSWORD
*password*here*
$ <ctrl-l> to clear screen
$ mysql -u username -p$DBPASSWORD [...etc...]
# method 2, use a file:
$ cat > passfile
*password*here*
$ <ctrl-l> to clear screen (or just have the file from a past session)
$ mysql -u username -p$(<passfile) [...etc...]
Neither is "secure", in the way Mikael points out. (The command as it's
being run has the password visible.) And the first is really for
one-off,but-frequent situations. (i.e. when you're really just sick of
typing the same password over and over.) The second method I use quite
a bit, for not-actually-secure passwords.
Generally (but not always) things that allow you to specify the password
on the command line also let you specify a password file on the command
line, which is at least one step better.
e.g. mysql has ~/.my.cnf
rsync has --password-file=
ldapsearch has -y
smbclient has -A
For SSH/GPG passwords, there are ssh-agent and gpg-agent. Other
programs have similar things. That lets you avoid typing the password
over-and-over at the risk of requiring the password only once during a
given time period or login session.
For anything for which you want *real* security, the answer is to, of
course, type it every time you need it. (For my money, ssh-agent makes
the best security vs. convenience tradeoff.)
--
Best,
Ben
next prev parent reply other threads:[~2011-02-01 22:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-01 21:15 Julien Nicoulaud
2011-02-01 21:28 ` Mikael Magnusson
2011-02-01 21:59 ` Julien Nicoulaud
2011-02-01 22:40 ` Benjamin R. Haskell [this message]
2011-02-01 22:57 ` Mikael Magnusson
2011-02-02 4:34 ` Bart Schaefer
2011-02-02 21:27 ` Julien Nicoulaud
2011-02-03 2:49 ` Bart Schaefer
2011-02-14 20:16 ` PJ Weisberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.01.1102011726120.2792@hp \
--to=zsh@benizi.com \
--cc=julien.nicoulaud@gmail.com \
--cc=mikachu@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).