all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Using tramp to connect to a remote emacs session
@ 2009-09-02 23:06 Suvayu Ali
  2009-09-03  8:02 ` Peter Dyballa
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Suvayu Ali @ 2009-09-02 23:06 UTC (permalink / raw
  To: Emacs mailing list

Hi everyone,

I usually have to connect to my lab using tramp (tramp-default-method is 
ssh) when I am working from home. Since I go back and forth a lot, I 
have to start a session every time. Is it possible for me to run 
emacs-server on my lab machine and connect to that using tramp from my 
home? That would save me a lot of time (mostly annoyance though ;) ) in 
starting a new session.

So far only reference I found was,

> Using emacsclient to make a new frame of a remote Emacs 22 on a local display
> 
> ssh remote_host -f emacsclient --eval ‘”(make-frame-on-display \”$DISPLAY\”)”’

in the emacswiki[1]. Firstly I don't understand how this works, and 
blindly copy-pasting this to the terminal didn't work either. Some help 
would be greatly appreciated. :)

I am using,
remote machine: Ubuntu 9.04 with Emacs 23
local machine:	Fedora 11 with Emacs 23

[1]http://www.emacswiki.org/emacs/EmacsClient#toc22

-- 
Suvayu

Open source is the future. It sets us free.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
  2009-09-02 23:06 Using tramp to connect to a remote emacs session Suvayu Ali
@ 2009-09-03  8:02 ` Peter Dyballa
  2009-09-03 16:06   ` Suvayu Ali
       [not found]   ` <mailman.5952.1251993987.2239.help-gnu-emacs@gnu.org>
  2009-09-03 13:08 ` Michael Albinus
       [not found] ` <mailman.5940.1251983344.2239.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 16+ messages in thread
From: Peter Dyballa @ 2009-09-03  8:02 UTC (permalink / raw
  To: Suvayu Ali; +Cc: Emacs mailing list


Am 03.09.2009 um 01:06 schrieb Suvayu Ali:

> So far only reference I found was,
>
>> Using emacsclient to make a new frame of a remote Emacs 22 on a  
>> local display
>> ssh remote_host -f emacsclient --eval ‘”(make-frame-on-display  
>> \”$DISPLAY\”)”’
>
> in the emacswiki[1]. Firstly I don't understand how this works, and  
> blindly copy-pasting this to the terminal didn't work either. Some  
> help would be greatly appreciated. :)


Ssh opens a connection to remote_host and logs you in. The option -f  
puts ssh into the background allowing to launch an X client. This one  
is emacsclient, which is asked to evaluate some Lisp. This Lisp code  
is make-frame-on-display, which makes GNU Emacs open (create) a new  
frame on the specified screen as given by the environment variable  
DISPLAY. On the remote host DISPLAY should point to your local screen  
and its X server. So the remote GNU Emacs daemon or server will open  
a frame as an X client of your local display's X server and  
communicate with it via the SSH tunnel.


If this does not work you can start to debug ssh, but particularly  
allow (trusted) X11 forwarding in the configuration of the SSH server  
on the remote host. Your local X server must be informed to accept  
connections from the remote host.

--
Greetings

   Pete

UNIX is user friendly, it's just picky about who its friends are.







^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
  2009-09-02 23:06 Using tramp to connect to a remote emacs session Suvayu Ali
  2009-09-03  8:02 ` Peter Dyballa
@ 2009-09-03 13:08 ` Michael Albinus
  2009-09-03 16:01   ` Suvayu Ali
       [not found] ` <mailman.5940.1251983344.2239.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 16+ messages in thread
From: Michael Albinus @ 2009-09-03 13:08 UTC (permalink / raw
  To: Suvayu Ali; +Cc: Emacs mailing list

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Hi everyone,

Hi,

> I usually have to connect to my lab using tramp (tramp-default-method is 
> ssh) when I am working from home. Since I go back and forth a lot, I 
> have to start a session every time. Is it possible for me to run 
> emacs-server on my lab machine and connect to that using tramp from my 
> home? That would save me a lot of time (mostly annoyance though ;) ) in 
> starting a new session.

Since you are not the first one who has asked, I've just added the
following to the Tramp manual (Frequently Asked Questions):

---
* How can I use TRAMP to connect to a remote GNU Emacs session?

  You can configure Emacs Client doing this.  On the remote host,
  you start the Emacs Server:

       (require 'server)
       (setq server-host (system-name)
             server-use-tcp t)
       (server-start)

  Make sure, that the result of `(system-name)' can be resolved on
  your local host; otherwise you might use a hard coded IP address.

  The resulting file `~/.emacs.d/server/server' must be copied to
  your local host, at the same location.  You can call then the
  Emacs Client from the command line:

       emacsclient /ssh:user@host:/file/to/edit

  `user' and `host' shall be related to your local host.
---

Best regards, Michael.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
  2009-09-03 13:08 ` Michael Albinus
@ 2009-09-03 16:01   ` Suvayu Ali
  2009-09-04  7:03     ` Michael Albinus
  0 siblings, 1 reply; 16+ messages in thread
From: Suvayu Ali @ 2009-09-03 16:01 UTC (permalink / raw
  To: Michael Albinus; +Cc: Emacs mailing list

Hi Michael,

On Thursday 03 September 2009 06:08 AM, Michael Albinus wrote:
> Suvayu Ali<fatkasuvayu+linux@gmail.com>  writes:
>
>> Hi everyone,
>
> Hi,
>
>> I usually have to connect to my lab using tramp (tramp-default-method is
>> ssh) when I am working from home. Since I go back and forth a lot, I
>> have to start a session every time. Is it possible for me to run
>> emacs-server on my lab machine and connect to that using tramp from my
>> home? That would save me a lot of time (mostly annoyance though ;) ) in
>> starting a new session.
>
> Since you are not the first one who has asked, I've just added the
> following to the Tramp manual (Frequently Asked Questions):
>

I think I went through that section but could not figure out how to get 
the server file. That became clear as soon I saw your little code 
snippet. :)

> ---
> * How can I use TRAMP to connect to a remote GNU Emacs session?
>
>    You can configure Emacs Client doing this.  On the remote host,
>    you start the Emacs Server:
>
>         (require 'server)
>         (setq server-host (system-name)
>               server-use-tcp t)
>         (server-start)
>
>    Make sure, that the result of `(system-name)' can be resolved on
>    your local host; otherwise you might use a hard coded IP address.
>
>    The resulting file `~/.emacs.d/server/server' must be copied to
>    your local host, at the same location.  You can call then the
>    Emacs Client from the command line:
>
>         emacsclient /ssh:user@host:/file/to/edit
>
>    `user' and `host' shall be related to your local host.

Correct me if I go wrong, when I issue that command emacsclient tells 
the remote server to connect with the localhost over tramp. It 
determines where the remote server is from the server file.

My problem is my ISP at the local machine doesn't allow me to login to 
it from outside. In other words I probably don't have a static ip. So 
when I issue the command I get,

> $ emacsclient /ssh:user@local.host:~/file
> emacsclient: connect: Connection refused
> emacsclient: connected to remote socket at xxx.xx.xxx.xx
> Waiting for Emacs...
>
> *ERROR*: Process died

And on the remote machine I get the following in the *Messages* buffer,

> Tramp: Opening connection for user@local.host using ssh...
> Tramp: Waiting 60s for local shell to come up...
> Tramp: Sending command `ssh local.host -l user  -q -e none && exit || exit'
> Tramp: Waiting for prompts from remote shell
> File error: Process died

So to summarize my problem is I can only connect one way, local.host to 
remote machine, and hence tramp fails to work. Does this mean the only 
way I will get this working is to get my ISP to give me a static ip?

Thanks for the help so far Michael. Much appreciated.

-- 
Suvayu

Open source is the future. It sets us free.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
  2009-09-03  8:02 ` Peter Dyballa
@ 2009-09-03 16:06   ` Suvayu Ali
       [not found]   ` <mailman.5952.1251993987.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 16+ messages in thread
From: Suvayu Ali @ 2009-09-03 16:06 UTC (permalink / raw
  To: Peter Dyballa; +Cc: Emacs mailing list

Hi Peter,

On Thursday 03 September 2009 01:02 AM, Peter Dyballa wrote:
>
> Am 03.09.2009 um 01:06 schrieb Suvayu Ali:
>
>> So far only reference I found was,
>>
>>> Using emacsclient to make a new frame of a remote Emacs 22 on a local
>>> display
>>> ssh remote_host -f emacsclient --eval ‘”(make-frame-on-display
>>> \”$DISPLAY\”)”’
>>
>> in the emacswiki[1]. Firstly I don't understand how this works, and
>> blindly copy-pasting this to the terminal didn't work either. Some
>> help would be greatly appreciated. :)
>
>
> Ssh opens a connection to remote_host and logs you in. The option -f
> puts ssh into the background allowing to launch an X client. This one is
> emacsclient, which is asked to evaluate some Lisp. This Lisp code is
> make-frame-on-display, which makes GNU Emacs open (create) a new frame
> on the specified screen as given by the environment variable DISPLAY. On
> the remote host DISPLAY should point to your local screen and its X
> server. So the remote GNU Emacs daemon or server will open a frame as an
> X client of your local display's X server and communicate with it via
> the SSH tunnel.
>
>
> If this does not work you can start to debug ssh, but particularly allow
> (trusted) X11 forwarding in the configuration of the SSH server on the
> remote host. Your local X server must be informed to accept connections
> from the remote host.
>

Thanks for the very clear explanation Pete. :) I had a hunch it is 
something like X-forwarding. I don't really like to do X-forwarding, the 
interface is usually very unresponsive. I would rather go with `emacs -nw'.

Thanks for the reply though. ^_^

-- 
Suvayu

Open source is the future. It sets us free.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
       [not found]   ` <mailman.5952.1251993987.2239.help-gnu-emacs@gnu.org>
@ 2009-09-03 16:34     ` Anselm Helbig
  2009-09-04  3:17       ` Suvayu Ali
       [not found]       ` <mailman.5986.1252034254.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 16+ messages in thread
From: Anselm Helbig @ 2009-09-03 16:34 UTC (permalink / raw
  To: help-gnu-emacs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2482 bytes --]

At Thu, 03 Sep 2009 09:06:16 -0700,
Suvayu Ali <fatkasuvayu+linux@gmail.com> wrote:
> 
> Hi Peter,
> 
> On Thursday 03 September 2009 01:02 AM, Peter Dyballa wrote:
> >
> > Am 03.09.2009 um 01:06 schrieb Suvayu Ali:
> >
> >> So far only reference I found was,
> >>
> >>> Using emacsclient to make a new frame of a remote Emacs 22 on a local
> >>> display
> >>> ssh remote_host -f emacsclient --eval ‘”(make-frame-on-display
> >>> \”$DISPLAY\”)”’
> >>
> >> in the emacswiki[1]. Firstly I don't understand how this works, and
> >> blindly copy-pasting this to the terminal didn't work either. Some
> >> help would be greatly appreciated. :)
> >
> >
> > Ssh opens a connection to remote_host and logs you in. The option -f
> > puts ssh into the background allowing to launch an X client. This one is
> > emacsclient, which is asked to evaluate some Lisp. This Lisp code is
> > make-frame-on-display, which makes GNU Emacs open (create) a new frame
> > on the specified screen as given by the environment variable DISPLAY. On
> > the remote host DISPLAY should point to your local screen and its X
> > server. So the remote GNU Emacs daemon or server will open a frame as an
> > X client of your local display's X server and communicate with it via
> > the SSH tunnel.
> >
> >
> > If this does not work you can start to debug ssh, but particularly allow
> > (trusted) X11 forwarding in the configuration of the SSH server on the
> > remote host. Your local X server must be informed to accept connections
> > from the remote host.
> >
> 
> Thanks for the very clear explanation Pete. :) I had a hunch it is 
> something like X-forwarding. I don't really like to do X-forwarding, the 
> interface is usually very unresponsive. I would rather go with `emacs -nw'.

If you want to connect to a remote emacs but don't want to do X
forwarding, then you can do either 

  - start emacs with the --daemon option on the remote host; you can
    now connect to the running emacs instance with `emacsclient -t'
    which will give you an emacs terminal frame. Which will, of
    course, work over ssh as well. You can still get a X frame if you
    like by not using -t. This requires Emacs 23 to work.

  - the obvious solution: use GNU screen or a similar tool (dtach,
    tmux, ...), start your console mode emacs in there and reconnect
    as necessary. Works with any version of emacs, obviously.

HTH, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
       [not found] ` <mailman.5940.1251983344.2239.help-gnu-emacs@gnu.org>
@ 2009-09-03 17:50   ` Benjamin Andresen
  2009-09-04 11:12     ` Suvayu Ali
  0 siblings, 1 reply; 16+ messages in thread
From: Benjamin Andresen @ 2009-09-03 17:50 UTC (permalink / raw
  To: help-gnu-emacs

Michael Albinus <michael.albinus@gmx.de> writes:

> * How can I use TRAMP to connect to a remote GNU Emacs session?
>
>   You can configure Emacs Client doing this.  On the remote host,
>   you start the Emacs Server:
>
>        (require 'server)
>        (setq server-host (system-name)
>              server-use-tcp t)
>        (server-start)
>
>   Make sure, that the result of `(system-name)' can be resolved on
>   your local host; otherwise you might use a hard coded IP address.
>
>   The resulting file `~/.emacs.d/server/server' must be copied to
>   your local host, at the same location.  You can call then the
>   Emacs Client from the command line:
>
>        emacsclient /ssh:user@host:/file/to/edit
>
>   `user' and `host' shall be related to your local host.

I don't quite get this. As I understand it the following happens:

Remote Emacs (R) has emacs running with the above server settings.
Local emacs (L) will copy the ~R/.emacs.d/server/server to
~L/.emacs.d/server/server

and then launch emacsclient -f server /ssh:user@L:/etc/localfile

But to do any editing, you still need to be at R (i.e. attached scree)
to see the /etc/localfile being opened. All the emacsclient line will do
is instruct R to open that file. After wards you then press C-x # on R to
close that connection.
(All L sees is "Waiting for Emacs..." until that happens.)

Why not ssh into R and just C-x C-f /ssh:user@L:/etc/localfile without
copying anything?

Therefor I don't see what you gain. You still need R to be able to
connect via ssh to L, which means it might possibly go trough a NAT.

What am I missing?

TIA,
benny


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
  2009-09-03 16:34     ` Anselm Helbig
@ 2009-09-04  3:17       ` Suvayu Ali
       [not found]       ` <mailman.5986.1252034254.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 16+ messages in thread
From: Suvayu Ali @ 2009-09-04  3:17 UTC (permalink / raw
  To: Anselm Helbig; +Cc: Emacs mailing list

Hi Anselm,

Anselm Helbig wrote:
> At Thu, 03 Sep 2009 09:06:16 -0700,
> Suvayu Ali <fatkasuvayu+linux@gmail.com> wrote:
>> Thanks for the very clear explanation Pete. :) I had a hunch it is 
>> something like X-forwarding. I don't really like to do X-forwarding, the 
>> interface is usually very unresponsive. I would rather go with `emacs -nw'.
> 
> If you want to connect to a remote emacs but don't want to do X
> forwarding, then you can do either 
> 
>   - start emacs with the --daemon option on the remote host; you can
>     now connect to the running emacs instance with `emacsclient -t'
>     which will give you an emacs terminal frame. Which will, of
>     course, work over ssh as well. You can still get a X frame if you
>     like by not using -t. This requires Emacs 23 to work.
> 
>   - the obvious solution: use GNU screen or a similar tool (dtach,
>     tmux, ...), start your console mode emacs in there and reconnect
>     as necessary. Works with any version of emacs, obviously.
> 

Sorry for going OT, I looked into screen after your post. Isn't it 
almost the same as any terminal emulators available on GNU/Linux 
systems? (xfce4-terminal, konsole, gnome-terminal ...)  What are the 
advantages offered by screen over a regular ssh session in one of these 
terminal emulators?

-- 
Suvayu

Open source is the future. It sets us free.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
       [not found]       ` <mailman.5986.1252034254.2239.help-gnu-emacs@gnu.org>
@ 2009-09-04  3:27         ` Benjamin Andresen
  2009-09-04 11:17           ` Suvayu Ali
  2009-09-04 11:19           ` Suvayu Ali
  0 siblings, 2 replies; 16+ messages in thread
From: Benjamin Andresen @ 2009-09-04  3:27 UTC (permalink / raw
  To: help-gnu-emacs

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Sorry for going OT, I looked into screen after your post. Isn't it
> almost the same as any terminal emulators available on GNU/Linux
> systems? (xfce4-terminal, konsole, gnome-terminal ...)  What are the
> advantages offered by screen over a regular ssh session in one of
> these terminal emulators?

screen complements a terminal emulator, because it does simultaneously
more and less than one.

From http://en.wikipedia.org/wiki/GNU_Screen

GNU Screen is a free terminal multiplexer that allows a user to access
multiple separate terminal sessions inside a single terminal window or
remote terminal session. It is useful for dealing with multiple programs
from the command line, and for separating programs from the shell that
started the program.


Features
        Persistence

        Similar to VNC, GNU Screen allows the user to start applications
        from one computer, and then reconnect from a different computer
        and continue using the same application without having to
        restart it.


        Multiple windows

        Multiple terminal sessions can be created, each of which usually
        runs a single application.


        Session Sharing
        
        Screen allows multiple computers to connect to the same session
        at once, allowing collaboration between multiple users.


If that doesn't answer the question, install it and follow this guide:
http://www.kuro5hin.org/story/2004/3/9/16838/14935

HTH,
benny
        


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
  2009-09-03 16:01   ` Suvayu Ali
@ 2009-09-04  7:03     ` Michael Albinus
  2009-09-04 11:05       ` Suvayu Ali
  0 siblings, 1 reply; 16+ messages in thread
From: Michael Albinus @ 2009-09-04  7:03 UTC (permalink / raw
  To: Suvayu Ali; +Cc: Emacs mailing list

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Hi Michael,

Hi,

>> ---
>> * How can I use TRAMP to connect to a remote GNU Emacs session?
>>
>>    You can configure Emacs Client doing this.  On the remote host,
>>    you start the Emacs Server:
>>
>>         (require 'server)
>>         (setq server-host (system-name)
>>               server-use-tcp t)
>>         (server-start)
>>
>>    Make sure, that the result of `(system-name)' can be resolved on
>>    your local host; otherwise you might use a hard coded IP address.
>>
>>    The resulting file `~/.emacs.d/server/server' must be copied to
>>    your local host, at the same location.  You can call then the
>>    Emacs Client from the command line:
>>
>>         emacsclient /ssh:user@host:/file/to/edit
>>
>>    `user' and `host' shall be related to your local host.
>
> Correct me if I go wrong, when I issue that command emacsclient tells 
> the remote server to connect with the localhost over tramp. It 
> determines where the remote server is from the server file.

Yes.

> My problem is my ISP at the local machine doesn't allow me to login to 
> it from outside. In other words I probably don't have a static ip. So 
> when I issue the command I get,
>
>> $ emacsclient /ssh:user@local.host:~/file
>> emacsclient: connect: Connection refused
>> emacsclient: connected to remote socket at xxx.xx.xxx.xx
>> Waiting for Emacs...
>>
>> *ERROR*: Process died

So at least emacsclient was able to connect your remote server. Good.

> And on the remote machine I get the following in the *Messages* buffer,
>
>> Tramp: Opening connection for user@local.host using ssh...
>> Tramp: Waiting 60s for local shell to come up...
>> Tramp: Sending command `ssh local.host -l user  -q -e none && exit || exit'
>> Tramp: Waiting for prompts from remote shell
>> File error: Process died

That I do not catch. Are the messages exactly as you have written, or
did you exchange the real user and host name by "user" and "local.host"?

Note, that "user" shall be the user name you run your local host, and
"local.host" must be an FQDN of your host, or an IP address.

> So to summarize my problem is I can only connect one way, local.host to 
> remote machine, and hence tramp fails to work. Does this mean the only 
> way I will get this working is to get my ISP to give me a static ip?

You have mentioned two different explanations. Either your ISP does not
allow you to login from the outside. Then we could stop. But usually,
they don't forbid it.

If you have a dynamic IP address (the other possiblitiy), you could run 

  emacsclient /ssh:user@1.2.3.4:/file/to/edit

"1.2.3.4" would be the IP address you are currently using. Because this
changes day by day, you might evaluate it every time in a script,
starting emacsclient.

The more simple solution is to register your local machine with dynamic
DNS. Let's say you have registered it at http://www.dyndns.com/, under
the name "suvayu.homelinux.org" (just as example). Then you could
connect via

  emacsclient /ssh:user@suvayu.homelinux.org:/file/to/edit

Another trap you could enter is your router configuration at home. You
must allow incoming connections at port 22 (for ssh), and it must be
forwarded to your local host.

> Thanks for the help so far Michael. Much appreciated.

Best regards, Michael.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
  2009-09-04  7:03     ` Michael Albinus
@ 2009-09-04 11:05       ` Suvayu Ali
  2009-09-04 11:37         ` Michael Albinus
  0 siblings, 1 reply; 16+ messages in thread
From: Suvayu Ali @ 2009-09-04 11:05 UTC (permalink / raw
  To: Michael Albinus; +Cc: Emacs mailing list

Hi Michael,

On Friday 04 September 2009 12:03 AM, Michael Albinus wrote:
> Suvayu Ali<fatkasuvayu+linux@gmail.com>  writes:
>
>> Correct me if I go wrong, when I issue that command emacsclient tells
>> the remote server to connect with the localhost over tramp. It
>> determines where the remote server is from the server file.
>
> Yes.
>
>> My problem is my ISP at the local machine doesn't allow me to login to
>> it from outside. In other words I probably don't have a static ip. So
>> when I issue the command I get,
>>
>>> $ emacsclient /ssh:user@local.host:~/file
>>> emacsclient: connect: Connection refused
>>> emacsclient: connected to remote socket at xxx.xx.xxx.xx
>>> Waiting for Emacs...
>>>
>>> *ERROR*: Process died
>
> So at least emacsclient was able to connect your remote server. Good.
>
>> And on the remote machine I get the following in the *Messages* buffer,
>>
>>> Tramp: Opening connection for user@local.host using ssh...
>>> Tramp: Waiting 60s for local shell to come up...
>>> Tramp: Sending command `ssh local.host -l user  -q -e none&&  exit || exit'
>>> Tramp: Waiting for prompts from remote shell
>>> File error: Process died
>
> That I do not catch. Are the messages exactly as you have written, or
> did you exchange the real user and host name by "user" and "local.host"?
>
My lab is a bit paranoid about security so I edited out the specifics 
and put in generic names. :)

> Note, that "user" shall be the user name you run your local host, and
> "local.host" must be an FQDN of your host, or an IP address.
>
The host name for my localhost is limited to the local network. The 
Siemens router from my ISP (Telus) probably implements some kind of NAT 
(I'm not sure). So the outgoing connection worked, whereas the incoming 
connection failed.

>> So to summarize my problem is I can only connect one way, local.host to
>> remote machine, and hence tramp fails to work. Does this mean the only
>> way I will get this working is to get my ISP to give me a static ip?
>
> You have mentioned two different explanations. Either your ISP does not
> allow you to login from the outside. Then we could stop. But usually,
> they don't forbid it.
>

I don't have a static IP, moreover from the outside I can only see my 
ISP's servers not my home machine. Hence I can't login from the outside.

> If you have a dynamic IP address (the other possiblitiy), you could run
>
>    emacsclient /ssh:user@1.2.3.4:/file/to/edit
>
> "1.2.3.4" would be the IP address you are currently using. Because this
> changes day by day, you might evaluate it every time in a script,
> starting emacsclient.
>
> The more simple solution is to register your local machine with dynamic
> DNS. Let's say you have registered it at http://www.dyndns.com/, under
> the name "suvayu.homelinux.org" (just as example). Then you could
> connect via
>
>    emacsclient /ssh:user@suvayu.homelinux.org:/file/to/edit
>

This is very interesting. I had no idea such a service existed! I will 
definitely look into this.

> Another trap you could enter is your router configuration at home. You
> must allow incoming connections at port 22 (for ssh), and it must be
> forwarded to your local host.
>

I can login to my router's admin interface, so that should not be 
difficult to setup.

Thanks for your patience. :)

-- 
Suvayu

Open source is the future. It sets us free.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
  2009-09-03 17:50   ` Benjamin Andresen
@ 2009-09-04 11:12     ` Suvayu Ali
  0 siblings, 0 replies; 16+ messages in thread
From: Suvayu Ali @ 2009-09-04 11:12 UTC (permalink / raw
  To: help-gnu-emacs

On Thursday 03 September 2009 10:50 AM, Benjamin Andresen wrote:
> Michael Albinus<michael.albinus@gmx.de>  writes:
>
>> * How can I use TRAMP to connect to a remote GNU Emacs session?
>>
>>    You can configure Emacs Client doing this.  On the remote host,
>>    you start the Emacs Server:
>>
>>         (require 'server)
>>         (setq server-host (system-name)
>>               server-use-tcp t)
>>         (server-start)
>>
>>    Make sure, that the result of `(system-name)' can be resolved on
>>    your local host; otherwise you might use a hard coded IP address.
>>
>>    The resulting file `~/.emacs.d/server/server' must be copied to
>>    your local host, at the same location.  You can call then the
>>    Emacs Client from the command line:
>>
>>         emacsclient /ssh:user@host:/file/to/edit
>>
>>    `user' and `host' shall be related to your local host.
>
> I don't quite get this. As I understand it the following happens:
>
> Remote Emacs (R) has emacs running with the above server settings.
> Local emacs (L) will copy the ~R/.emacs.d/server/server to
> ~L/.emacs.d/server/server
>
> and then launch emacsclient -f server /ssh:user@L:/etc/localfile
>
> But to do any editing, you still need to be at R (i.e. attached scree)
> to see the /etc/localfile being opened. All the emacsclient line will do
> is instruct R to open that file. After wards you then press C-x # on R to
> close that connection.
> (All L sees is "Waiting for Emacs..." until that happens.)
>
> Why not ssh into R and just C-x C-f /ssh:user@L:/etc/localfile without
> copying anything?
>
The /etc/localfile is local to R not L. ssh-ing to R would mean either 
X-forwarding or using `emacs -nw'. Whereas this way I get the whole gui 
and since Tramp edits a localfile in /tmp I am independent on any 
network issues until I actually do `C-x C-s' to save my edits.

> Therefor I don't see what you gain. You still need R to be able to
> connect via ssh to L, which means it might possibly go trough a NAT.
>
> What am I missing?
>
> TIA,
> benny


-- 
Suvayu

Open source is the future. It sets us free.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
  2009-09-04  3:27         ` Benjamin Andresen
@ 2009-09-04 11:17           ` Suvayu Ali
  2009-09-04 11:19           ` Suvayu Ali
  1 sibling, 0 replies; 16+ messages in thread
From: Suvayu Ali @ 2009-09-04 11:17 UTC (permalink / raw
  To: help-gnu-emacs

Hi Benny,

I had gone through the wikipedia article and thought tabs in terminal 
emulators solve my problems with ease.

On Thursday 03 September 2009 08:27 PM, Benjamin Andresen wrote:
>
> If that doesn't answer the question, install it and follow this guide:
> http://www.kuro5hin.org/story/2004/3/9/16838/14935
>

Thank you for this link. I will definitely checkout screen seems like a 
good way to be immune from hangups. :)

-- 
Suvayu

Open source is the future. It sets us free.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
  2009-09-04  3:27         ` Benjamin Andresen
  2009-09-04 11:17           ` Suvayu Ali
@ 2009-09-04 11:19           ` Suvayu Ali
  1 sibling, 0 replies; 16+ messages in thread
From: Suvayu Ali @ 2009-09-04 11:19 UTC (permalink / raw
  To: help-gnu-emacs

Hi Benny,

On Thursday 03 September 2009 08:27 PM, Benjamin Andresen wrote:
> screen complements a terminal emulator, because it does simultaneously
> more and less than one.
>
>  From http://en.wikipedia.org/wiki/GNU_Screen
>
I had gone through the wikipedia article and thought tabs in terminal 
emulators solve my problems with ease.

> If that doesn't answer the question, install it and follow this guide:
> http://www.kuro5hin.org/story/2004/3/9/16838/14935
>
hank you for this link. I will definitely checkout screen seems like a 
good way to be immune from hangups. :)

-- 
Suvayu

Open source is the future. It sets us free.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
  2009-09-04 11:05       ` Suvayu Ali
@ 2009-09-04 11:37         ` Michael Albinus
  2009-09-05  5:29           ` Suvayu Ali
  0 siblings, 1 reply; 16+ messages in thread
From: Michael Albinus @ 2009-09-04 11:37 UTC (permalink / raw
  To: Suvayu Ali; +Cc: Emacs mailing list

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Hi Michael,

Hi,

> The host name for my localhost is limited to the local network. The 
> Siemens router from my ISP (Telus) probably implements some kind of NAT 
> (I'm not sure). So the outgoing connection worked, whereas the incoming 
> connection failed.

When you have connected to the remote host, call "who":

slbpky:~> who 
albinus  tty7         2009-09-02 16:19 (:0)
albinus  pts/0        2009-09-02 16:19 (localhost:10.0)
albinus  pts/1        2009-09-04 08:29 (100.200.100.200)
albinus  pts/2        2009-09-04 08:31 (localhost:12.0)

The string "100.200.100.200" I have used instead of my real values ...
This is the IP address your router is visible in the net. You can try to
reach it from your remote host via "ping 100.200.100.200".

If you have enabled NAT forwarding of port 22 in our router (Siemens
router shall allow this), you can even try "ssh user@100.200.100.200".
You shall reach your local host from the remote one.

> I don't have a static IP, moreover from the outside I can only see my 
> ISP's servers not my home machine. Hence I can't login from the outside.

I hope you see at least your router as described above.

>> The more simple solution is to register your local machine with dynamic
>> DNS. Let's say you have registered it at http://www.dyndns.com/, under
>> the name "suvayu.homelinux.org" (just as example). Then you could
>> connect via
>>
>>    emacsclient /ssh:user@suvayu.homelinux.org:/file/to/edit
>
> This is very interesting. I had no idea such a service existed! I will 
> definitely look into this.

You shall register your router as dynamic DNS client (most routers offer
this), because this device is visible from outside, and not your local
host. And via NAT forwarding you reach the sshd daemon on your local
host.

> Thanks for your patience. :)

Best regards, Michael.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Using tramp to connect to a remote emacs session
  2009-09-04 11:37         ` Michael Albinus
@ 2009-09-05  5:29           ` Suvayu Ali
  0 siblings, 0 replies; 16+ messages in thread
From: Suvayu Ali @ 2009-09-05  5:29 UTC (permalink / raw
  To: Emacs mailing list

Hi Michael,

On Friday 04 September 2009 04:37 AM, Michael Albinus wrote:
> Suvayu Ali<fatkasuvayu+linux@gmail.com>  writes:
>
>> The host name for my localhost is limited to the local network. The
>> Siemens router from my ISP (Telus) probably implements some kind of NAT
>> (I'm not sure). So the outgoing connection worked, whereas the incoming
>> connection failed.
>
> When you have connected to the remote host, call "who":
>
> slbpky:~>  who
> albinus  tty7         2009-09-02 16:19 (:0)
> albinus  pts/0        2009-09-02 16:19 (localhost:10.0)
> albinus  pts/1        2009-09-04 08:29 (100.200.100.200)
> albinus  pts/2        2009-09-04 08:31 (localhost:12.0)
>
> The string "100.200.100.200" I have used instead of my real values ...
> This is the IP address your router is visible in the net. You can try to
> reach it from your remote host via "ping 100.200.100.200".
>
> If you have enabled NAT forwarding of port 22 in our router (Siemens
> router shall allow this), you can even try "ssh user@100.200.100.200".
> You shall reach your local host from the remote one.
>
>> I don't have a static IP, moreover from the outside I can only see my
>> ISP's servers not my home machine. Hence I can't login from the outside.
>
> I hope you see at least your router as described above.
>

Unfortunately I can't ping my router from the remote machine and get a 
response. It seems my ISP is the culprit. Call to tech support didn't 
help either. :( I will try posting on my distro's user list. This has 
become way off-topic here.

Wish me luck. And thanks to all those who replied to the thread.

-- 
Suvayu

Open source is the future. It sets us free.




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2009-09-05  5:29 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-02 23:06 Using tramp to connect to a remote emacs session Suvayu Ali
2009-09-03  8:02 ` Peter Dyballa
2009-09-03 16:06   ` Suvayu Ali
     [not found]   ` <mailman.5952.1251993987.2239.help-gnu-emacs@gnu.org>
2009-09-03 16:34     ` Anselm Helbig
2009-09-04  3:17       ` Suvayu Ali
     [not found]       ` <mailman.5986.1252034254.2239.help-gnu-emacs@gnu.org>
2009-09-04  3:27         ` Benjamin Andresen
2009-09-04 11:17           ` Suvayu Ali
2009-09-04 11:19           ` Suvayu Ali
2009-09-03 13:08 ` Michael Albinus
2009-09-03 16:01   ` Suvayu Ali
2009-09-04  7:03     ` Michael Albinus
2009-09-04 11:05       ` Suvayu Ali
2009-09-04 11:37         ` Michael Albinus
2009-09-05  5:29           ` Suvayu Ali
     [not found] ` <mailman.5940.1251983344.2239.help-gnu-emacs@gnu.org>
2009-09-03 17:50   ` Benjamin Andresen
2009-09-04 11:12     ` Suvayu Ali

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.