all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Peter Münster" <pmlists@free.fr>
To: help-gnu-emacs@gnu.org
Subject: Re: tramp and ssh-key  passphrase
Date: Mon, 29 Feb 2016 13:49:45 +0100	[thread overview]
Message-ID: <87y4a3wuja.fsf@roche-blanche.net> (raw)
In-Reply-To: 87povflvw7.fsf@gmx.de

[-- Attachment #1: Type: text/plain, Size: 761 bytes --]

On Mon, Feb 29 2016, Michael Albinus wrote:

> There is the recommendation to use ssh-agent, which is always good.

Indeed.

And if
- you want to type the passphrase only once at the start of your
  X-session
- and your ssh-passphrase is the same as your gpg-passphrase
- and the passphrase should never expire
- and ssh-connections should work from cron-jobs,

then you could
- copy the attached askpass.lisp file to ~/bin
- and fill the list of the fingerprints
- and copy the attached gpg-agent.conf to ~/.gnupg
- and put these 2 lines to your ~/.xinitrc:
  SSH_ASKPASS=~/bin/askpass.lisp ssh-add
  echo $SSH_AUTH_SOCK >~/.ssh/ssh-auth-sock
- and start your cron-job shell scripts with
  export SSH_AUTH_SOCK=`cat ~/.ssh/ssh-auth-sock`

-- 
           Peter

[-- Attachment #2: askpass.lisp --]
[-- Type: application/octet-stream, Size: 633 bytes --]

#!/usr/bin/sbcl --script

;; vielleicht so:
;; gpg --list-secret-keys --with-fingerprint --with-fingerprint --with-colon
;; --list-options no-show-unusable-uids,no-show-unusable-subkeys | sed -rn 's/^fpr:::::::::(.*):/\1/p'

(defvar *fingerprints*
  (list "XXX"
        "YYY"
        "ZZZ"))

(with-output-to-string (out)
  (run-program "/usr/lib/ssh/ssh-askpass" nil :output out)
  (let ((s (get-output-stream-string out)))
    (dolist (fp *fingerprints*)
      (with-input-from-string (in s)
        (run-program "/usr/lib64/gpg-preset-passphrase" (list "--preset" fp)
                     :input in :output nil)))
    (princ s)))

[-- Attachment #3: gpg-agent.conf --]
[-- Type: text/plain, Size: 74 bytes --]

allow-preset-passphrase
default-cache-ttl 99999999
max-cache-ttl 99999999

  reply	other threads:[~2016-02-29 12:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-28 14:28 tramp and ssh-key passphrase lee
2016-02-29  9:15 ` Michael Albinus
2016-02-29 12:49   ` Peter Münster [this message]
2016-03-18 19:39   ` lee
     [not found] <mailman.6191.1456683386.843.help-gnu-emacs@gnu.org>
2016-02-29  7:24 ` Loris Bennett
2016-03-18 19:38   ` lee
2016-03-18 20:21     ` Jorge A. Alfaro-Murillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y4a3wuja.fsf@roche-blanche.net \
    --to=pmlists@free.fr \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.