Closed bedaberner closed 1 week ago
Thanks for opening! I'd love to get @roblourens's expertise here.
I'm not sure you want to run ssh-add
on every login, just after creating a key, right? There's a line above about running it to setup your key.
The point about eval "cat $HOME/.ssh/ssh-agent"
, I don't know whether it's an issue, I don't have an opinion there.
Oh sorry, you're saying that you have to do this after starting the agent because it doesn't persist on Linux, is that really the case in general? I didn't remember that.
If we're going to recommend it, it might be better practice to add a particular key rather than running it to add all keys?
I don't have deep knowledge about how ssh-add
works but i can confirm that on Ubuntu 24.04 (running in wsl2) you have to execute ssh-add
on every reboot. This is also mentioned in the stack-overflow issue I cited above. It can be confirmed by running ssh-add -l
which will return an empty list after reboot.
If we're going to recommend it, it might be better practice to add a particular key rather than running it to add all keys?
I have no preference whatsoever about adding a specific key or all of them. For my use case adding all of them works fine.
The point about eval "cat $HOME/.ssh/ssh-agent", I don't know whether it's an issue, I don't have an opinion there.
For me it's definitely an issue if my terminal echoes random stuff every time I open it. Maybe that's just me but I think it should not be recommended behavior, especially since the information provided is not useful.
Right, I think we should hide the output here.
And I think it's fine to run ssh-add here, other recommendations on the web are very scattered obviously, but I think we might as well update it to add one key by name, to match our other example above.
This seems fine to me, thanks
as ssh-add does not persist in linux, the ssh-add command must be executed every time and should therefore be added to the snippet (see this stackoverflow answer which led me to finding this).
Furthermore I found it annoying that
eval "cat $HOME/.ssh/ssh-agent"
echoes the PID of the ssh-agent and therefore polutes your terminal, therefore I suggest muting it's output.