help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plaintext yank from ~/.authinfo [DANGER]


From: Emanuel Berg
Subject: Re: plaintext yank from ~/.authinfo [DANGER]
Date: Thu, 07 Oct 2021 14:54:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> First congrats to a very good looking authinfo-mode [...]

Bonus info!

How to use the authfile to get password-free ssh-ing despite
the pubkeys scheme not being used ...

Put this in ~/.emacs.d/ssh-pass.el

(require 'auth-source)

(message (auth-source-pick-first-password
          :host "..."
          :user "...") )

machine ... login ... port ... password ...

(for host, state the machine; for user, the login. quotes are
used in the Elisp script but not in the authfile)

I have the port sunos-ssh which is defined as a Tramp method
[last]

Then use a shell function

#! /bin/zsh

mic () {
    local pass=$(emacs --batch --load ~/.emacs.d/ssh-pass.el 2>&1)
    sshpass -p $pass \
            ssh -o ServerAliveInterval=120 ${USER}@${HOST}
}

https://dataswamp.org/~incal/conf/.zsh/remote-mic

done :)

;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;;   http://user.it.uu.se/~embe8573/emacs-init/tramp-incal.el
;;;   https://dataswamp.org/~incal/emacs-init/tramp-incal.el

(require 'tramp)
(require 'tramp-sh)

(setq tramp-histfile-override nil)

(add-to-list 'tramp-methods
  '("sunos-ssh"
    (tramp-login-program       "ssh")
    (tramp-login-args        (("-l" "%u")
                              ("-p" "%p")
                              ("%c")
                              ("-e" "none")
                              ("-t" "-t")
                              ("%h")
                              ("\"/bin/sh -i\"") ))
    (tramp-async-args        (("-q")))
    (tramp-remote-shell        "/bin/sh")
    (tramp-remote-shell-login ("-l"))
    (tramp-remote-shell-args  ("-c")) ))

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]