SSH Agent in Jetbrains products
Hello everyone
FYI: We're running Kubuntu 24.04 LTS!
I recently switched to having my ssh keys stored in Bitwarden desktop as oppose to having them flying around in ~/.ssh/. Consequently, I make them accessible via an ssh agent, which relies on the SSH_AUTH_SOCK environment variable being set to point to the correct socket belonging to Bitwarden. So I added export SSH_AUTH_SOCK=path/to/bitwarden.sock to my .bashrc.
I did a bit of experimenting, assisted by a LLM, and we concluded that the environment is dropped or ignored when launching a jetbrains app via the toolbox or the ~/local/share/applications/Pycharm_[…].desktop for example. However, this is the way I tend to launch my applications. The solutions offered by the LLM were:
- Patch the toolbox and/or the .desktop file (which is annoying, considering it is rewritten with every update)
- Always launch the applications from a shell.
I doubt I'm the only one using Bitwarden for this purpose and by the output of the LLM, there must have been some options that are now merged or removed which used to be available. How are you guys dealing with SSH Agents which supply private keys both for git and SSH?
I really hope there's a solution I've failed to see as oppose to having to always patch the toolbox executable environment as well as the applications themselves.
Best
A.Sotoudeh
请先登录再写评论。
This is a known Linux desktop behavior: applications launched from Toolbox or .desktop shortcuts start with the login shell environment, so they do not source ~/.bashrc. Variables you export there, including SSH_AUTH_SOCK, are invisible to graphically-launched apps.
If you are on 2025.3 or newer, there is a built-in solution:
1. Open Help | Edit Custom VM Options in your JetBrains IDE.
2. Add this line: -Dij.load.shell.env=true
3. Restart the IDE.
With this option set, the IDE will read your full interactive shell environment at startup, including SSH_AUTH_SOCK. This works for any variable set in ~/.bashrc.
Please let me know if that helps. Thank you!
Best regards,
Uros Glogovac
IntelliJ Support
Hi
Yes your suggestion solved the issue.
Thank you so much.
A.Sotoudeh