Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: A few lines in .zshenv (re ssh-agent) disable scp and rsync?



On Mon 27 at 03:36 AM -0400, "Benjamin R. Haskell" <zsh@xxxxxxxxxx> wrote:

> So, you could also solve this by conditioning all of the ssh-agent
> actions on whether a terminal is connected:
> 
> # if stdin is a terminal (unnecessary in .zshrc)
> if [[ -t 0 ]] ; then
> 	# kill the ssh-agent on exit
> 	trap '[[ -n "$SSH_AGENT_PID" ]] && eval `ssh-agent -k`' 0
> 	# start the ssh-agent if not already started
> 	[[ -z "$SSH_AGENT_PID" ]] && eval `ssh-agent`
> 	# add identities to the agent
> 	ssh-add
> fi


My first impulse was to use your code here, and leave it in .zshenv, so
that if it ever got copied and put somewhere else, it would have its
precautions against being output to a terminal already built in.  (I.e.,
it's self-sufficient.)

As opposed to keeping my own code and putting it in .zshrc.

But when I did the former, I discovered that when I login to the account,
I get this prompt twice, instead of once:

Enter passphrase for /net/u/5/r/rj/.ssh/id_rsa:

I use this to ssh from that account to others (only use it from a workpace
windows machine; when I'm at home, I ssh to those other accounts directly
from my home box, not from this account. From home I don't enter the
passprhrase here after having logged into the account, I just hit return.)

So for the moment at least, I've moved the code I had in .zshenv to .zshrc
and am using that.  Thanks for the education, hope I'm doing the prudent
thing, probably need to look into it a bit more & will check the link you
posted.




Messages sorted by: Reverse Date, Date, Thread, Author