Re: ssh-add after graphical login
On Thu, Mar 23, 2023 at 09:42:53AM +0100, Yassine Chaouche wrote:
> I'd like something to run ssh-add right after I login to my desktop
> (KDE).
> ssh-add needs to prompt me for my passphrase,
> and doesn't need any privileges.
>
> What are my options?
On Debian you can create a ~/.xsessionrc file which is executed by
/bin/sh when starting an X session, either by DM login or startx.
Inside that file, you should be able to run:
ssh-add </dev/null
When run with stdin redirected in that way, it launches a GUI instead
of prompting on the terminal.
The only part I'm unsure of, for you, is how to ensure that this runs
*after* your ssh agent has already been started. I don't know how ssh
agent startup is handled with Display Manager logins, since I don't use
a DM, and I just start ssh-agent myself, right before running ssh-add.
So, maybe just putting that command in ~/.xsessionrc is sufficient, or
maybe it's not. You can try it and see.
Reply to: