Ethical Hacking Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package. | Computer Forensics Training at InfoSec Institute Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors. |

| Subject: | Re: Defering passphrase entry with ssh-add |
|---|---|
| Date: | Fri, 23 Nov 2007 12:18:46 +0000 |
On Tue, Nov 20, 2007 at 07:01:21PM +0000, Christopher Key wrote:
I've done created a Bash solution for now,
alias ssh="ssh-add -l >/dev/null; if [ \$? = 1 ]; then ssh-add; fi; ssh"
hardly elegant, but it does the job. I'm not aware of any technical reason why ssh-add couldn't defer requesting a password until its required.
This is technically infeasible, if not impossible.
Err, the above is perfectly feasible.
ssh-add needs to ask you for your passphrase. A process can't run in the background ifYes which is why you only check/run it when ssh is used. but the agent is started before.
it needs to ask the user for input...
It needs to run in the foreground until it does this, and it needs to stay connected to yourCertainly not. My ssh-agent follows me around in whichever pts or tty I use.
terminal so it can ask you for it -- it would tie up your terminal
until it determined it needed your passphrase.
Again, ssh-agent works for me across all terminals as well as just in X, it's ssh-add you are talking about here which isIf you put this in your .profile or whatever other login file, you would never get a shell prompt until you typed your passphrase. I suppose if you were in X it could conceivably spawn an X client to pop up a dialog to ask you for the passphrase, but that could only work in X.
Also, how would ssh know if you didn't have a key for this connection,err, you check for the presence of your ssh key(s). This is very basic programmatic control. Come on.
or if you just hadn't yet typed your passphrase?
Not likely unless you are a one finger typist in which case I insist you stop using any unix immediately. If you're not using unix or some derivative, but instead using Windows, bad luck but at least it's well suited to your skill level. :-)If the user had a long passphrase, and made several mistakes typing it, the ssh connection could time out before you got it right.
It's actually a good point though, your shot is way off. If you have for example, a laptop, you power it up, open a terminal, ah, this stupid secondary prompt is in the way.Even if it's technically possible, it's really gross. And for what benefit? So you can delay typing your passphrase, which you're going to need to type eventually anyway?
It seems to me trying to hack this in isDepends on how easy it is for you to do, took me literally one minute, but yields years of future convenience. Especially for a laptop which you are always switching on and off but not always using ssh.
totally not worth it.
If you want to delay, just don't run ssh-addEvery time you boot your laptop? Why give yourself the extra work. Not very smart.
until you need to ssh...
Only if you don't know anything. This is a 1 minute fix in bash.The requirements of this feature are ridiculously complex,
all to avoid having to type 7 characters (i.e.If you do a lot of stuff, streamlining is good. Repetition is stupid. I am significantly faster than any colleague in my company because of all the customization I have. It's one of the differences between newbies and veterans.
by putting ssh-add in your .profile instead of just typing it when you
know you're going to need it).
-h
-- Hari Sekhon
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Restricted (ksh -r) shell and SSH on AIX5.1, Derek Martin |
|---|---|
| Next by Date: | Re: Defering passphrase entry with ssh-add, Derek Martin |
| Previous by Thread: | Re: Defering passphrase entry with ssh-add, Derek Martin |
| Next by Thread: | Restricted (ksh -r) shell and SSH on AIX5.1, Rob Sherry |
| Indexes: | [Date] [Thread] [Top] [All Lists] |