reddit / emacs

Problem with TRAMP, pubkey auth, ssh-agent under emacs

AsterOps · 2022-04-12 07:24
I have issue with my TRAMP. I am using `exec-path-from-shell` package, I have properly configured in emacs environment variables: ``` #+begin_src emacs-lisp (getenv "SSH_AUTH_SOCK") #+end_src #+RESULTS: : /tmp/ssh-XXXXXXB00fvW/agent.12069 #+begin_src emacs-lisp (getenv "SSH_AGENT_PID") #+end_src #+RESULTS: : 12070 ``` I run `M-x shell`, then ``` ssh-add ~/.ssh/id_rsa ``` type passhprase, receive confirmation that identity added. Then I try connect to one of my host defines in `~/.ssh/config` file with `IdentityFile /.ssh/id_rsa` declaration and I am asked again by the emacs about passphrase. How to solve that? Public key is properly deployed on remote host.
Phil-Hudson · 2022-04-12 07:48
Your shell runs its own init files, which may result in different environment variables. What happens when you run these two commands in your `shell` buffer: echo "$SSH_AUTH_SOCK" echo "$SSH_AGENT_PID"
AsterOps · 2022-04-12 10:27
You're right I had ``` eval "$(ssh-agent -s)" > /dev/null ``` in my `.bashrc` file (my workaround for having always `ssh-agent` always enabled in terminal) which probably causes some conflicts with emacs