[Top][All Lists]

[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

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}

done :)

;;; -*- lexical-binding: t -*-
;;; this file:

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

(setq tramp-histfile-override nil)

(add-to-list 'tramp-methods
    (tramp-login-program       "ssh")
    (tramp-login-args        (("-l" "%u")
                              ("-p" "%p")
                              ("-e" "none")
                              ("-t" "-t")
                              ("\"/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

reply via email to

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