1

I have followed the instructions here https://www.funtoo.org/Keychain and added

eval `keychain --eval --agents ssh --inherit any id_rsa`

to - I have tried both but the result was the same - .zshrc and .zprofile. Now the first terminal that I open requires me to enter the password for the SSH key (as expected) but after that, I never need to enter the password, independently of how many terminals I open.

However, if I log in to this machine using SSH I need to enter the SSH key password every time I connect. Obviously there is some difference how the shell is setup if I open a new terminal session sitting in front of the machine or open an SSH session.

How do I make SSH logins "inherit" the Funtoo Keychain setup/environment so I don't need to enter the password for the SSH key every time I log in to this machine using SSH?

d-b
  • 1,703
  • 2
  • 17
  • 26
  • https://unix.stackexchange.com/questions/537637/sshing-into-system-with-zsh-as-default-shell-doesnt-run-etc-profile have you checked if it runs as a login shell? `if [[ -o login ]]; then; print yes; else; print no; fi` it should – dza Aug 22 '20 at 13:40
  • @dza I am not sure I understand how to use the linked Q&A in my situation. Do you think you could elaborate? Thank you. – d-b Aug 20 '23 at 09:46
  • use snippet I posted in prev comment and report back if it says yes or no in the term you tried. – dza Aug 20 '23 at 11:00
  • @dza I SSH from A to B. Your snippet returns "yes" on both A and B. – d-b Aug 20 '23 at 13:31
  • I just reread question, its been 3 years and now I think I can answer your question.. Look for `${HOME}/.keychain/${HOST}-sh` directory in home.. this is where you can source `source ~/.keychain/hostname-sh` that file and your keychain should be initiated with the `ssh-agent` PID I think, try to read the file.. it sets environment variable.. – dza Aug 20 '23 at 17:37
  • @dza I am not followinf you here. The `${HOME}/.keychain/${HOST}-sh` is not a directory, it is a file with this content `SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.5fhOwlNPlb/Listeners; export SSH_AUTH_SOCK;`. I don't have `~/.keychain/hostname-sh` file. Thank you. – d-b Aug 20 '23 at 18:13
  • yes, that file is being made after you typed your password, so all you have to do is `source ${HOME}/.keychain/${HOST}-sh` on the shell you connect after you have authenticated the ssh-key.. – dza Aug 20 '23 at 18:22

0 Answers0