You are not logged in.

#1 2017-03-13 17:36:36

Sweenu
Member
Registered: 2016-12-08
Posts: 27

[Solved] SSH Agent : How to make it ask password only if I use ssh ?

Hello,

I've been unable to find a solution that works to my probelm :
I have added my only ssh key to the ssh-agent. I use that key to pull and push to my Github repos but the thing is it asks me "Enter passphrase for /home/sweenu/.ssh/id_rsa:" every time I boot my computer...

As I don't always code, I usually don't need to use the key so I'd like a way for the ssh-agent to ask me for the password only if I do push or pull. (Or worst case, don't ask me at all)

Thanks! smile

Last edited by Sweenu (2017-03-15 17:50:16)

Offline

#2 2017-03-13 17:42:02

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: [Solved] SSH Agent : How to make it ask password only if I use ssh ?

There's a solution on wiki... I believe it's about unlocking the keyring on login.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2017-03-13 17:52:31

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] SSH Agent : How to make it ask password only if I use ssh ?

Moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#4 2017-03-14 13:39:29

Sweenu
Member
Registered: 2016-12-08
Posts: 27

Re: [Solved] SSH Agent : How to make it ask password only if I use ssh ?

Thank you for your answer! t
The wiki does indeed show how to start the agent on login but what I'd like to have is for the agent to start only if I try using the key (by pulling or pushing to Github).

Maybe it is just not possible. If that's the case, is there another tool that'd let me do that ?

Offline

#5 2017-03-14 15:47:36

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: [Solved] SSH Agent : How to make it ask password only if I use ssh ?

I recall having issues with this in the past, I now have this 2 lines in my .xinitrc
When I start ssh connection, I get a popup screen, fill in the PW for the key, and I'm done for this session, hope it helps you.

 eval $(/usr/bin/gnome-keyring-daemon --start --components=gpg,pkcs11,secrets,ssh)
 export SSH_AUTH_SOCK  DBUS_SESSION_BUS_ADDRESS

Offline

#6 2017-03-14 16:49:55

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] SSH Agent : How to make it ask password only if I use ssh ?

This only happens if you have a keyring/chain of some sort running. Presumably, you are using a DE that does that for you.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2017-03-15 10:40:11

Sweenu
Member
Registered: 2016-12-08
Posts: 27

Re: [Solved] SSH Agent : How to make it ask password only if I use ssh ?

qinohe wrote:

I recall having issues with this in the past, I now have this 2 lines in my .xinitrc
When I start ssh connection, I get a popup screen, fill in the PW for the key, and I'm done for this session, hope it helps you.

 eval $(/usr/bin/gnome-keyring-daemon --start --components=gpg,pkcs11,secrets,ssh)
 export SSH_AUTH_SOCK  DBUS_SESSION_BUS_ADDRESS

Thank you for the tip, however, I don't use a desktop environment so it won't work for me (I guess?)

jasonwryan wrote:

This only happens if you have a keyring/chain of some sort running.

I'm not sure what keyring or chains are but you tell me I should look into that to solve my problem ?

Offline

#8 2017-03-15 10:52:34

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: [Solved] SSH Agent : How to make it ask password only if I use ssh ?

I'm using i3 ...

edit:
@jasonwryan, your right, there must have been something wrong with my setup when I started using that lines, I changed it to use the if statement from the wiki, works fine right away  wink

Last edited by qinohe (2017-03-15 12:58:46)

Offline

#9 2017-03-15 15:29:00

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] SSH Agent : How to make it ask password only if I use ssh ?

My point was that, if you are not running a DE, then it is something that you must have either explicitly or unwittingly set up. Look through your shell initialisation files for what is starting the agent or keychain or whatever Gnome calls it (seamonkey?).


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#10 2017-03-15 17:49:38

Sweenu
Member
Registered: 2016-12-08
Posts: 27

Re: [Solved] SSH Agent : How to make it ask password only if I use ssh ?

Thank you!
That was indeed the problem. I'm running zsh with zim and it had a module that autoloaded the ssh-agent... That is why the problem wasn't that common.
Anyway, it's perfect now, thanks again.

Offline

Board footer

Powered by FluxBB