Frederick Bartlett <[email protected]> writes:

Hi Fred,

> Here's your shell experiment (same result as from inside Emacs):
>
>     $ ssh -l ec2-user  -o ControlMaster=auto -o ControlPath='tramp.%C'
>     -o ControlPersist=no -e none xx.xxx.xxx.xxx
>     [email protected]: Permission denied
>     (publickey,gssapi-keyex,gssapi-with-mic).
>
> And here's my usual ssh command (which works):
>
>     ssh -i <path_to_public_key_file> -o ServerAliveInterval=5 -o
>     ServerAliveCountMax=1 [email protected]

The difference is "-i <path_to_public_key_file>". Is it located
somewhere else but in ~/.ssh? An unusal name? And is it really a public
key file? Ususally, "-i" specifies the identity (private key) file.

> Could I edit the Tramp command in Emacs to include a reference to
> public key?

Sure. Have a look at tramp-methods. There is an entry like

--8<---------------cut here---------------start------------->8---
 ("ssh"
  (tramp-login-program "ssh")
  (tramp-login-args
   (("-l" "%u")
    ("-p" "%p")
    ("%c")
    ("-e" "none")
    ("%h")))
  (tramp-async-args
   (("-q")))
  (tramp-remote-shell #1#)
  (tramp-remote-shell-login
   ("-l"))
  (tramp-remote-shell-args
   ("-c")))
--8<---------------cut here---------------end--------------->8---

You could overwrite the tramp-login-args element, via a connection
property "login-args". Consult the docstring of tramp-methods for the
meaning of the %x templates. And consult the Tramp manual about
connection properties at (info "(tramp) Predefined connection
information")

Alternatively, you could add an entry in your ~/.ssh/config like this:

--8<---------------cut here---------------start------------->8---
Host foo
        HostName        xx.xxx.xxx.xxx
        User            ec2-user
        IdentityFile    /path/to/identity/file
--8<---------------cut here---------------end--------------->8---

With this, you can use Tramp via "/ssh:foo:". And also in your shell,
you can call directly "ssh foo".

> Thanks,
> Fred

Best regards, Michael.

Reply via email to