41
votes

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!

6

6 Answers

18
votes

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.
43
votes

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 $ 
17
votes

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.

6
votes

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

1
votes

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

1
votes

Emacs option for ssh : c-x c-f /ssh:user@host:/home/path/

For Reference: Open file via SSH and Sudo with Emacs