You are not logged in.

#1 2017-01-02 22:07:18

cutuchiqueno
Member
Registered: 2013-07-06
Posts: 70

[SOLVED] keychain raises error when a second terminal is opened

In the past I used keychain to manage my ssh key within one boot period across terminal sessions as described in the Wiki:

eval $(keychain --eval --agents ssh -Q --quiet /home/cutuchiqueno/.ssh/id_rsa)

Lately, I created more ssh keys for different services and also started to let keychain manage gpg-agent:

eval $(keychain --eval --agents ssh,gpg -Q --quiet /home/cutuchiqueno/.ssh/id_rsa /home/cutuchiqueno/.ssh/id_rsa_pi B41F933C)

However, after changing the config this way I get the following error when I open a second terminal and after I already provided passwords in the first terminal

 * Warning: can't find /home/cutuchiqueno/.ssh/id_rsa; skipping
 * Warning: can't find /home/cutuchiqueno/.ssh/id_rsa_pi; skipping

Nevertheless, authentication to the associated remotes and services works perfectly.

I am using zsh within termite

Thx.

Last edited by cutuchiqueno (2017-01-03 11:42:31)

Offline

#2 2017-01-02 22:08:20

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

Re: [SOLVED] keychain raises error when a second terminal is opened

Where are you invoking keychain: in .zshrc?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-01-03 08:50:45

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 79,182

Re: [SOLVED] keychain raises error when a second terminal is opened

"PATH_TO_SSHKEY1" is redacted? Don't do that - the filename is no secret and you should check whether it (or whatever you enter there, eg. a variable or a command) is there.

@jasonwryan: because it's suggested in the wiki ;-P
https://wiki.archlinux.org/index.php/SSH_keys#Keychain

@cutuchiqueno
the idea is to run that *once* per session, eg. with some desktop init script or, in your case, rather a systemd user service  - not in every shell instance.

Offline

#4 2017-01-03 10:40:43

cutuchiqueno
Member
Registered: 2013-07-06
Posts: 70

Re: [SOLVED] keychain raises error when a second terminal is opened

@jasonwryan yes, in .zshrc following the page mentioned by @seth

@seth ok, I understand the argument why it is better to use with systemd. However, I still do not understand why it worked before but not anymore when I add a second ssh key and a gpg key.

Two additional personal problems for me are that systemd service files are still a mysterious world to me and after reading your response I haven't found any example service file doing that job. Or can I just do the same example with gpg-agent, given at https://wiki.archlinux.org/index.php/Gn … stemd_user to ssh-agent?

Second question is one of understanding: Is the reason to invoke keychain in .zshrc not the possibility to directly enter the passhrases in the open terminal. Ok, gpg has pinentry to popup but ssh does not have a similar component, does it? So I need the open terminal to enter the passphrase, don't I?

Last edited by cutuchiqueno (2017-01-03 10:49:21)

Offline

#5 2017-01-03 11:42:04

cutuchiqueno
Member
Registered: 2013-07-06
Posts: 70

Re: [SOLVED] keychain raises error when a second terminal is opened

I decided to let gpg-agent handle ssh keys as it is described in the wiki article on GnuPG and dropped keychain. It works well. The decision was provoked by @seth's recommendation to use systemd. So, thank you!

Offline

#6 2017-01-03 13:04:57

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 79,182

Re: [SOLVED] keychain raises error when a second terminal is opened

Well about why it work and doesn't - the error is that the passed files do not (no longer?) exist, so the answer will be in
- what are those files exactly
- are they really gone after the first shell invocation?

You could test for their existance to branch the keychain invocation (if you ever return)

Systemd user services are explained here: https://wiki.archlinux.org/index.php/Systemd/User
Look at the example to autostart X11 (and translate it to autorun keychain)

Offline

#7 2017-01-03 16:53:39

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

Re: [SOLVED] keychain raises error when a second terminal is opened

.zshrc is the wrong file; call it from .zprofile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB