[PLUG] Using ssh-agent and ssh-add
Robert Citek
robert.citek at gmail.com
Thu Mar 30 21:51:04 UTC 2017
On Thu, Mar 30, 2017 at 1:28 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> On Thu, 30 Mar 2017, Rich Shepard wrote:
>
>> My laptops are not always on. When I do fire up one and want to exchange
>> files with the desktop each transaction requires my typing my passphrase.
>> Can I add ssh-agent and ssh-add to ~/.bash_profile so I need type the
>> passphrase only once after booting a host?
>
> A bit of research tells me that's not practical. But, when I turn on a
> portable I can invoke ssh-agent bash followed by ssh-add and the passphrase.
> That will hold it until I shut down the system
>
> If there's a more efficient way I'd appreciate learning it.
This is a simplified version of what I have in my ~/.profile :
[ -z "$SSH_AGENT_PID" ] && tty -s && exec ssh-agent bash --login
[ -n "$SSH_AGENT_PID" ] && tty -s && {
echo -e "\nAdding keys to ssh-agent ..."
ssh-add ~/.ssh/*_rsa
echo
ssh-add -l
}
Try this on a test user account before integrating it into your real account.
Good luck and let us know how it works for you.
Regards,
- Robert
More information about the PLUG
mailing list