Hacker Newsnew | past | comments | ask | show | jobs | submit | ogsuspect's commentslogin

I am a die-hard iterm + tmux user and often have many login shells open spread across many iterm windows/tabs, tmux sessions/windows/panes, etc.

I was tired of dealing with the pain of ssh-agent so I wrote some bash scripting that caches the agent environment, kills any extra uncached agents and automatically "attaches" to the cached environment so you don't have to type your ssh key passphrases in over and over.

Feel free to contribute, also feel free to talk trash :)


Curious if this could work to minimize 2FA authentications for repeated short SSH sessions? Particularly ssh commands run by 3rd party software such as Sourcetree. Every new connection requires acknowledgement of 2FA push notification.


See ClashTheBunny's comment about Control sockets. You can `man 5 ssh-config` and search for the following settings 'ControlMaster', 'ControlPath', 'ControlPersist'. ControlMaster is a yes/no/auto... you probably want 'auto'. ControlPath is the path where the control socket is created. You probably want something dynamic like `ControlPath ~/.ssh/ctrl-%h`. ControlPersist specifies how long the control socket should remain open for. This enables SSH connection multiplexing.


I think you want multiplexing:

https://en.m.wikibooks.org/wiki/OpenSSH/Cookbook/Multiplexin...

It creates a control socket that lasts up to x minutes after your last session closes, so for me, all day + 15 minutes, which then new connections go over instead of re-athenticating.

Many places disable it for "security" reasons.


Curious if this could work to minimize 2FA authentications for repeated short SSH sessions? Particularly ssh commands run by 3rd party software such as Sourcetree.


If you're okay with a non-open source app (App store purchase) -- "Magnet" is the way to go.

Otherwise go with whats been suggested by others


Thats because they come from GNU Readline


I agree, Readline is the reason they got so widespread. But note that except Bash, none of the shells and interpreters I listed actually use GNU Readline these days — and that Emacs and its keybindings predates Readline.


I had a lot higher hopes for this.

I get the impression OP is a junior dev.


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: