4
I have to run the following commands each time I restart:
ssh-agent /bin/bash
ssh-add ~/.ssh/key_rsa
First question is why is /bin/bash
necessary and what it is used for?
Second, Is it ok I run these commands every time on restart, or should I put this in .bashrc
or somewhere so I don't have to ssh-add
everytime.
Note that I use screen
and every screen tab is different and I have to run these commands for every screen tab.
Edit:
For example when I need to push to github I need to do ssh-add ~/.ssh/github_rsa
, but this doesn't work unless I do ssh-agent /bin/bash
first.
This might be related to screen
because plain ssh-agent
doesn't work, and ssh-agent is already running, yet I have to do ssh-agent /bin/bash
.
Just curious what problem you are trying to solve - how do you determine "I have to run the following" ; to get an ssh key in each login I have the following as a single line in my .bashrc "eval
keychain --eval id_rsa id_dsa
" – nwaltham – 2014-10-02T11:01:12.813@nwaltham for example I run these commands if I want to push to github, I need to do
ssh-add github_rsa
if I haven't done already. (ssh-add
doesn't work by default so I have to runssh-agent /bin/bash
first). Can you explain your solution a little more, what iskeychain
and post it as answer. Also see my edit please. – mattheew – 2014-10-02T11:50:49.450You should check out ssh-ident if you haven't found or heard of it yet. It's obviously been a while since the op, but you never know. It fixes your issue of having to always restart the agent and add your keys - and it does it in just about the most secure way currently available ... unless I've missed something. https://github.com/ccontavalli/ssh-ident
– CreationTribe – 2019-10-31T08:29:39.937