I use Bash for my terminal on Debian. In my .bashrc
, I've defined an environmental variable like so:
SSH_VAULT_VM="ssh-vault"
if [ "$SSH_VAULT_VM" != "" ]; then
export SSH_AUTH_SOCK=~user/.SSH_AGENT_$SSH_VAULT_VM
fi
This is to facilitate separating my SSH private/public keys on my bare metal host OS (Qubes OS) as described in this repo. The way split SSH works in Qubes OS is by hosting the private key in a VM, and the public key in another VM (from which I'm running Emacs). Whenever I use SSH then, a dialog box pop-up appears to confirm accessing the private key.
When I open Emacs from a Bash terminal, the SSH_AUTH_SOCK
variable is properly defined (as observed in the initial-environment
variable), and attempts to use the SSH key (e.g., in the magit
package) succeed with the pop-up confirmation box. However, when I open the Emacs GUI (using X?), the SSH_AUTH_SOCK
variable is incorrect (instead set to something like: /tmp/ssh-[some random name]/agent.[3 digit number]
) and attempts to use the SSH key fail.
How can I make Emacs use my .bashrc
settings such that this split SSH feature will work? I'd be happy to either correct some config to make Emacs load this variable correctly, or overwrite it with the correct value in my .emacs.d
file. I've tried including something like: (setenv "SSH_AUTH_SOCK" "/home/user/.SSH_AGENT_ssh-vault")
in my Emacs config, but that doesn't seem to work.
$HOME/.profile
. It might or might not work (depending on how your desktop environment gets initialized) but it's much more likely to happen with$HOME/.profile
..bashrc
will obviously have no effect.