Skip to content

use keychain if available to automatically start ssh-agent#2

Merged
x70b1 merged 2 commits intox70b1:masterfrom
SuperBFG7:master
Jan 29, 2026
Merged

use keychain if available to automatically start ssh-agent#2
x70b1 merged 2 commits intox70b1:masterfrom
SuperBFG7:master

Conversation

@SuperBFG7
Copy link
Contributor

I tried to start the ssh-agent as a user service, but somehow the timing was off and it did not seem to start before the script tried to add the keys. So instead I added an option to use keychain, if installed.

Maybe you find this usefull.

In any case: thank you for the script, works perfectly for me with greetd, while pam_ssh did not.

cheers!
Daniel

@x70b1
Copy link
Owner

x70b1 commented Jan 28, 2026

Yes, maybe if you start the agent after the login its slower than the pam-script. In my case the agent is always running and I restart them after logout, so that the system has no keys in the logged out state.

What would be the benefit of hash over if [ -f /usr/bin/keychain ... ?
With the test we wouldnt need to execute a binary.

@SuperBFG7
Copy link
Contributor Author

I believe hash is a builtin command of bash. The benefit is, that it checks whether bash knows the command and does not assume its location or type (binary, alias, …). In this case the difference does probably not matter, I started to use it instead of test -f for all checks of executables.

I see shellcheck failed, will fix that tomorrow.

@x70b1
Copy link
Owner

x70b1 commented Jan 28, 2026

$ type hash
hash is a shell builtin

cool! :)

@x70b1 x70b1 merged commit f9bd584 into x70b1:master Jan 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants