Emacs 24.3.1 TRAMP hangs on opening file - emacs

I am running graphical Emacs 24.3.1 (this problem exists when using the console version as well) on Arch Linux. I am trying to use TRAMP to open files on a remote Fedora system by SSH with a private key which requires a password. Authentication works fine, and so does the listing of files. When I do try to open a file, my Emacs session hangs with "Tramp: Inserting `/{filename I'm trying to open}' ...done". It is not possible to abort with ESC ESC ESC or C-g. Does anyone have a solution to this?

Emacs 24 normally works very well with Tramp. What you might need is ControlMasterAuto in your .ssh/config file. This will ensure that the ssh connection information passes seamlessly to Emacs. This will also ensure that you only need to login once in a terminal and use multiple emacs frames in tramp mode. I have detailed the following steps
(1) Go to your .ssh/config file and add the following options
Host <hostname>
ControlMaster auto
ControlPath ~/.ssh/%r#%h:%p
ServerAliveCountMax=30
ServerAliveInterval=5
(2) Now login to the remote host through terminal.
(3) Open emacs frame and try opening the remote files through tramp (/ssh:). You must be able to connect to the remote host.
The above steps should work even for a two level authentication (using a rsa key +password).

This thread is old - however, a very similar problem on my FC22 laptop (tramp hanging when trying to type a colon following /su in the minibuffer) appears to be fixed by commenting the ::1 line in /etc/hosts.

Related

tramp mode will not work (ssh cannot resolve hostname)?

Earlier this week I tried ssh'ing into my lab machine (as I do very frequently) via tramp mode (ubuntu 14.04) and now it seems to not work out of the blue. I have tried checking all folder permissions, that ssh actually works (in terminal, even nested in emacs). However, it still will not connect me. I see the connection in my .ssh file so I am not sure what the issue is. Any ideas? This is killing my productivity since I would much rather tramp in vs git everything.
######### from C-x C-f ssh:user#host...etc (which has always worked in the past) #######
ssh: Could not resolve hostname ssh: Name or service not known
########## from *Messages buffer* #####################
Tramp: Opening connection for ssh using scp...
Tramp: Sending command `exec ssh -e none ssh'
Tramp: Waiting for prompts from remote shell
Tramp: Sending command `exec ssh -e none ssh'
Tramp: Opening connection for ssh using scp...done
byte-code: Process died
side note: I did start having pop-ups w/ system program problem detected but the ONLY thing in the /var/crash folder is a virtual box issue so I cant imagine that could be it. (Can I purge emacs and grab my config again and solve it that way?)
The error message clearly indicates that you are doing C-x C-f /ssh:user#host/path/to/file. A colon is missing after host. Pls open this like C-x C-f /ssh:user#host:/path/to/file.

Backspace doesn't work in ssh in term-mode inside emacs

I'm running a terminal inside emacs, using term-mode. In that terminal I'm ssh-ing to another host and on that host, the backspace key no longer works. It works fine if I'm ssh-ing from a different terminal emulator outside of emacs.
So just to be clear, I'm not running emacs on the remote host, I'm running a remote shell inside emacs.
So it is your terminal in emacs you need fix, :D
I had a similar issue with a perticular setup where backspace key through ssh act as delete key, seems emacs sometime have problem guessing which one is which in non-GUI setting.
what I did is change (normal-erase-is-backspace-mode 1) from 1 to 0. You could try that, but is sounds like a terminal issue to me.
reference in emacs manaul about that setting

Emacs-Tramp: Not working properly

I'm trying to use Tramp/Emacs-23 in Ubuntu 12.04 in order to edit the remote host files. My remote host has two step authentication (RSA+Passwd). I use multiplexing through .ssh/config to ensure that tramp can directly connect to the remote shell without having to provide passwords.
My problem however is that I have 3 different remote hosts. When I try to connect to remote host through tramp without the initial multiplexing (through terminal), the TRAMP hangs with a message stating "Tramp: Waiting for prompts from remote shell". I used the below mentioned commands in .ssh/config to ensure the connection gets lost after a specified interval upon no prompt.
Host *
ServerAliveCountMax=30
ServerAliveInterval=5
However this doesn't seem to have any effect on the tramp connection. It will be of help if someone can help me in fixing this issue.
Sorry that your question has been left hanging so long.
I can offer a couple of things to try, use the tramp protocol sshx instead of ssh, it seems to cope better with most non-vanilla ssh connections.
e.g.
/sshx:user#host:path/filename
The other thing to try is adding your ssh key passphrase to the session at startup, run an ssh-agent on the machine, and connect to it at startup, then run ssh-add to enter the passphrase once.
As a side note, upgrade your Emacs to 24.3 there's a lot of new/great stuff in there since 23.x

Tramp mode in emacs using ssh config

I think this is very basic question in using tramp, but it doesn't work for me.
I have my ~/.ssh/config file that points to my amazon ec2 machine
Host amazon
Hostname xxxx.amazonaws.com
Port yyy
User me
IdentityFile ~/.ssh/ubuntu
ForwardAgent yes
I can easily do ssh amazon from my terminal and I go to amazon ec2 (so my config is right), but in emacs
I do:
C-x C-f /ssh1:amazon:
I always get this error
In Aquamacs:
Process *tramp/ssh1 amz* exited abnormally with code 255
In Emacs:
tramp: Opening connection at amz using ssh1...
tramp: Waiting for prompts from remote shell
tramp: Waiting 60s for prompt from remote shell
tramp-process-actions: Login failed
I also have other ssh configurations that they ssh to my virtual boxes on my local machine and they have the same problem.
I really appreciate any help.
One thing that's worth trying is using the sshx connection method. That makes tramp try to avoid any non-standard shell configuration on the remote host.
Like this:
C-x C-f /sshx:amazon:
The tramp method ssh1 forces ssh to be run in ssh v1 protocol mode with the parameter -1. ssh v1 has known weaknesses and is insecure. Hence a lot of sites disable the ssh v1 protocol.
You can verify this from the shell with ssh -1 me#xxxx.amazonaws.com.
Try other tramp connection methods like ssh, sftp or scpx. You can see all pre-configured connection methods with C-h v tramp-methods.
If Moritz Bunkus's answer doesn't solve the issue, then you can configure the verbosity of tramp's output with
M-x customize-variable RET tramp-verbose RET
In particular, level 6 is "sent and received strings" which might help you to determine whether the "Waiting for prompts from remote shell" is because it isn't receiving a prompt pattern that it recognises, or because of some more critical failure.
If it's simply receiving a prompt it doesn't recognise, then you might look at customizing the tramp-login-prompt-regexp or tramp-shell-prompt-pattern variables.
(Of course if your ssh agent is working correctly, then login prompts shouldn't be relevant.)
If you're running Emacs in Windows, then also see these Q&As:
Emacs: Tramp doesn't work
Using tramp with EmacsW32 and cygwin, possible?

ssh through emacs shell?

I wonder if anyone out there uses ssh through the emacs shell. I am able to connect with the remote machine but I cannot open files to view/edit with emacs using 'emacs filename' as the 'Terminal type "dumb" is not powerful enough to run emacs' (normally emacs would open within the console when connecting through the terminal).
Is this a bad idea to try to use emacs in such a way, or is this possible with a few fixes? Thanks much!
It may not be obvious on first sight, but eshell, the shell that is
implemented in Emacs Lisp works fine with tramp:
Welcome to the Emacs shell
~ $ uname -a
Linux local-machine 2.6.30-1-686 #1 SMP Thu Jul 30 14:45:30 UTC 2009 i686 GNU/Linux
~ $ cd /ssh:user#remote-machine:~
/ssh:user#remote-machine:/home/user $ uname -a
Linux remote-machine 2.6.18-6-686 #1 SMP Thu Aug 20 21:56:59 UTC 2009 i686 GNU/Linux
/ssh:user#remote-machine:/home/user $
A couple of ideas
Source the .bashrc explicitly via . ~/.bashrc and/or rearrange your bash init files and ~/.profile so that this gets loaded inside the emacs shell; then running ssh inside the Emacs shell works just fine
Use the emacs-specific Tramp mode to access remote files via ssh inside your local Emacs -- this is useful if you just need to update/touch/edit a remote file so you would not need to open a remote emacs inside the ssh session started from inside your local emacs.
Emacs has term-mode which is full blown terminal emulator you can run emacs in emacs. Anything you run on terminal will run in term-mode
Also emacs has tramp mode which can open files through ssh.
/scp:user#ipOrHost#port:/
it will transfer files back and forth. you just edit them as you would edit local files.
No need for x11 forwarding or other shenanigans.
You could use ssh x forwarding to run a remote emacs and display it on the local computer. I use Xming X Server when I'm on Windows
You could mount the remote filesystem with ssh and open the locally as normally.
For this I use ExpanDrive (commercial app) when on Windows
You could use emacs Ange ftp over ssh it can open remote files over ftp and ssh.
I use this with cygwin when on Windows
I have been struggling with Xming, which works, but as my internet connection is not the fastest I have to wait more 30 seconds before emacs or any X app even shows up. Also scrolling through a buffer after it has been opened will freeze from time to time => Very annoying
Try No machine (nxserver-freenx server/client). There are free edition servers, absolute the best and fastest solution when you want to connect to a Linux box and use xterm and emacs over X. It shows up immediately and responds so fast. Even over a really slow connection :-) Clients are available for Windows, Mac OS, Linux
Emacs option for ssh : c-x c-f /ssh:user#host:/home/path/
For Reference: Open file via SSH and Sudo with Emacs