You are not logged in.
I am confusing with ssh-agent and ssh-add. If this post is old, sorry. I can't find solution googling.
I added the key following this https://wiki.archlinux.org/title/SSH_keys#SSH_agents
and I can see added identity using
$ ssh-add -l
in the same terminal session.
then I closed the terminal and open another terminal and run, it says the followings;
$ ssh-add -l
Could not open a connection to your authentication agent.
but ssh-agent is running, I think.
$ pgrep -f ssh-agent
1087
$ pgrep -u $USER ssh-agent
1087
And I also have AddKeysToAgent yes in my `~/.ssh/config` file
Last edited by duyinthee (2023-03-12 11:45:49)
Offline
The new "terminal" (or rather shell) likely won't have the necessary environment exported?
https://wiki.archlinux.org/title/SSH_keys#ssh-agent
Offline
Yes, that is environment variable. I put the following in ~/.bashrc
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env"
fi
if [[ ! -f "$SSH_AUTH_SOCK" ]]; then
source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
fi
It solve the problem. Thanks.
Offline