ssh-el
ssh-el copied to clipboard
ssh -i ~/.ssh/identity fails in cygwin emacs as ssh does not do file expansion
Using cygwin's latest emacs, 24.5.1 (i686-pc-cygwin) of 2015-06-23...
M-x ssh -i ~/.ssh/<identityfile> fails even as M-x ssh -i C:\Users\Jerry\.ssh\<identityfile> succeeds
Oddly enough, under NT Emacs, that is, the native emacs windows port, M-x ssh -i ~/.ssh/<identityfile> seems to work.
I tried to use ssh -i to ssh into an amazon ec2 instance.
M-x
ssh arguments (hostname first) ssh [email protected] -i ~/.ssh/amazon-devel.pem
Warning: Identity file ~/.ssh/amazon-devel.pem not accessible: No such file or directory.
Permission denied (publickey).
Process *ssh [email protected]* exited abnormally with code 255
But it works from inside a shell
$ ssh -v [email protected] -i ~/.ssh/amazon-devel.pem
OpenSSH_7.1p1, OpenSSL 1.0.2e 3 Dec 2015
debug1: Reading configuration data /c/Users/Jerry/.ssh/config
debug1: Connecting to ec2...] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/Jerry/.ssh/amazon-devel.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/Jerry/.ssh/amazon-devel.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH_6.6.1* compat 0x04000000
...
debug1: Entering interactive session.
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-48-generic x86_64)
...
Last login: Sat Jan 16 22:26:25 2016
ubuntu@ip:~$
...
I believe the issue is that the elisp ssh is not doing the file name expansion that the shell does before exec'ing the actual ssh.
I think this is an issue because
- ssh is an interactive command and so should handle the common ways that emacs users would try to use ssh based on their experiences.
- and very little else about cygwin emacs requires windows style paths and well, I don't think ssh should either....
I'm actually not working on ssh-mode anymore; I started over from nothing with nssh-mode.
I'm not sure how I'd solve your specific problem, as the issue is that the supplied argument needs to be canonicalized, but the arguments to ssh are freeform, so determining which part(s) need canonicalization may be difficult.
I'd recommend that instead of passing an -i argument to SSH, you edit your SSH configuration to set up a host-based IdentityFile, ala:
Host *.mycorp.com
User ieure
IdentityFile ~/.ssh/mycorp_id
I'm not sure how I'd solve your specific problem, as the issue is that the supplied argument needs to be canonicalized, but the arguments to ssh are freeform, so determining which part(s) need canonicalization may be difficult
I think when I realized that was shortly before I came here to open the issue, hoping to punt it to someone with more insight. But yeah, it wasn't clear who is really supposed to do what here.
I do think IdentityFile's are the workaround, but at the same time, it also seemed like a bug to be fixed.
Thanks and when I get back to needing this, I'll try out nssh-mode.
I looked at nssh-el a very little bit, and I notice that one thing I could do with ssh mode is pass along parameters to ssh providing the host name and then pass long parameters (to ssh) with arguments after the host name. I don't seem able to do that with nssh
Which prompts me to wonder
- which mode, nssh or ssh is in the best state to use?
- Are they both working? Which should a n00b use first?
- Are you actively working on nssh?
- are you interesed in patches and a discussion of how it works
- where is the best place to discuss issues, as issues here, or via email or via ??
Thanks