You are not logged in.

#1 2014-01-03 04:43:11

aurelieng
Member
Registered: 2010-02-02
Posts: 104

[SOLVED] ssh-agent support removed from kde-agent

Hi all,

Since its upgrade yesterday, kde-agent does not support ssh-agent anymore (see here). I consequently can't store unlocked SSH keys anymore, because ssh-add from a konsole can't connect to ssh-agent.

The update note above mentions that the SSH agent is not needed by KDE since years. What's the recommended way to start it now ?

Thanks a lot !

Aurélien.

Last edited by aurelieng (2014-01-03 08:39:49)

Offline

#2 2014-01-03 08:10:31

ilpianista
Fellow developer
Registered: 2007-10-06
Posts: 568
Website

Re: [SOLVED] ssh-agent support removed from kde-agent

aurelieng wrote:

What's the recommended way to start it now ?

Any of the methods described here:
https://wiki.archlinux.org/index.php/SSH_Keys#ssh-agent

You can also copy the old ssh- scripts into your ~/.kde4/env and ~/.kde4/shutdown folders, check permissions, and make sure they are executable.

Personally, I added eval $(ssh-agent) to my ~/.profile, which is sourced by ~/.zsh_profile.

Offline

#3 2014-01-03 08:40:31

aurelieng
Member
Registered: 2010-02-02
Posts: 104

Re: [SOLVED] ssh-agent support removed from kde-agent

Thanks. I added to my ~/.profile too.

Offline

#4 2014-01-06 16:22:24

sjakub
Member
From: Canada/Poland
Registered: 2008-06-16
Posts: 84

Re: [SOLVED] ssh-agent support removed from kde-agent

Doesn't this run a separate agent for every shell session you create?

Offline

#5 2014-01-06 16:26:58

aurelieng
Member
Registered: 2010-02-02
Posts: 104

Re: [SOLVED] ssh-agent support removed from kde-agent

That's what i was afraid of. Fortunately, it doesn't run a separate agent for each konsole, but it does start a new one automatically if I connect through SSH to a machine I'm already logged in with X, for instance. Quite convenient smile

Offline

#6 2014-01-07 13:32:15

oi_wtf
Member
From: /home/wtf
Registered: 2012-03-11
Posts: 191

Re: [SOLVED] ssh-agent support removed from kde-agent

aurelieng wrote:

The update note above mentions that the SSH agent is not needed by KDE since years. What's the recommended way to start it now ?

I'd like to know that, too.

Since the update suggests there's another (better) way to manage one's key(s)
I'd like to try that, especially if it's really a better way.


Laptop:   Arch Linux (x86_64) and Win10 (x86_64);  Intel Core i7-3630QM @ 2.40GHz, 8 GiB RAM, NViDiA GeForce GT 650M w/ 2 GiB
Desktop: Arch Linux (x86_64) and Win10 (x86_64);  Intel Core i7-4771  @ 3.50GHz, 32 GiB RAM, AMD Radeon RX 480 w/ 8 GiB

Offline

#7 2014-01-08 02:17:33

sjakub
Member
From: Canada/Poland
Registered: 2008-06-16
Posts: 84

Re: [SOLVED] ssh-agent support removed from kde-agent

It looks like the .profile method creates one ssh-agent per X session. But once I log out and log back in, I end up having two ssh-agent.
Is there a way to kill it when I log out? Or maybe there is a new, better method for dealing with ssh-agent (or different way of dealing with passwords for SSH keys in general)?
If there isn't, why was it removed in the first place? The ".profile method" looks more like a hack to get sort-of old behaviour...

Last edited by sjakub (2014-01-08 02:18:02)

Offline

#8 2014-01-08 13:25:19

andrej.podzimek
Member
From: Zürich, Switzerland
Registered: 2005-04-10
Posts: 115

Re: [SOLVED] ssh-agent support removed from kde-agent

I have been using ssh-agent with KDE on a daily basis for years and AFAIK, there is no better or more convenient way of keeping your private keys available. So in my opinion, the removal of ssh-agent, a tiny daemon that doesn't do any harm yet serves its purpose very well, was a bad idea.

I found a solution that does not run multiple ssh-agent daemons, even if KDE crashes. The solution is based on the fact that ssh-agent can be used as a wrapper around a session startup script or program. Unfortunately, my solution is very intrusive and will disappear on each KDE update. It works as follows:

# cd /usr/bin
# mv startkde startkde-inner
# cat > startkde <<- HERE
        #!/bin/sh
        exec /usr/bin/ssh-agent /usr/bin/startkde-inner
HERE
# chmod +x startkde

Now the ssh-agent will be started on each KDE session and there will always be only one ssh-agent per KDE session. Comments in the startkde script suggest starting ssh-agent later in the process and then killing it on logout. However, such a solution is inherently unreliable, because it will not kill your ssh-agent when the X-server or KDE crashes. The same problem applies to starting ssh-agent from profile scripts. The wrapper method resolves the issue in a quite reasonable way.

Last edited by andrej.podzimek (2014-01-08 13:27:25)

Offline

#9 2014-01-08 13:32:59

aurelieng
Member
Registered: 2010-02-02
Posts: 104

Re: [SOLVED] ssh-agent support removed from kde-agent

@andrej.podzimek: I couldn't agree more. Unfortunately it seems the maintainer of kde-agent does not want to reintroduce the feature, as he closed your bug report a few hours ago :-/

Do you think it would be a good idea to create an AUR package named e.g "kde-agent-ssh" , that would contain the 'ssh-agent-startup.sh' 'ssh-agent-shutdown.sh' scripts ?

Edit: here it is: https://aur.archlinux.org/packages/kde-agent-ssh

Last edited by aurelieng (2014-01-08 16:34:05)

Offline

#10 2014-02-23 13:32:03

gauthma
Member
Registered: 2010-02-16
Posts: 215
Website

Re: [SOLVED] ssh-agent support removed from kde-agent

andrej.podzimek wrote:

Unfortunately, my solution is very intrusive and will disappear on each KDE update. It works as follows:

# cd /usr/bin
# mv startkde startkde-inner
# cat > startkde <<- HERE
        #!/bin/sh
        exec /usr/bin/ssh-agent /usr/bin/startkde-inner
HERE
# chmod +x startkde

Now the ssh-agent will be started on each KDE session and there will always be only one ssh-agent per KDE session. Comments in the startkde script suggest starting ssh-agent later in the process and then killing it on logout. However, such a solution is inherently unreliable, because it will not kill your ssh-agent when the X-server or KDE crashes. The same problem applies to starting ssh-agent from profile scripts. The wrapper method resolves the issue in a quite reasonable way.

If you start KDE from .xinitrc, you can modify the startkde line like so:

exec ssh-agent startkde

This wraps around startkde in a more seamless manner, and so far seems to be working!

Offline

#11 2016-06-02 17:28:26

Hwesta
Member
Registered: 2013-01-09
Posts: 3

Re: [SOLVED] ssh-agent support removed from kde-agent

It's not KDE specific, but since the kde-agent-ssh package no longer exists, the systemd solution worked for me.

~/.config/systemd/user/ssh-agent.service

[Unit]
Description=SSH key agent

[Service]
Type=forking
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK

[Install]
WantedBy=default.target

Add

export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"

to your shell's startup file (and reload it to get the changes).  Enable it with

systemctl --user enable ssh-agent

and start with

systemctl --user start ssh-agent

Offline

#12 2016-09-08 16:26:11

nachopro
Member
Registered: 2013-08-23
Posts: 78

Re: [SOLVED] ssh-agent support removed from kde-agent

Hwesta wrote:

It's not KDE specific, but since the kde-agent-ssh package no longer exists, the systemd solution worked for me.
....

It works like a charango!!! Thanks!

Offline

Board footer

Powered by FluxBB