all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* EShell tips on SSH?
@ 2013-01-15  0:13 Wenshan Ren
  2013-01-15  7:32 ` Bob Proulx
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Wenshan Ren @ 2013-01-15  0:13 UTC (permalink / raw
  To: help-gnu-emacs

Hi,

I manage a few VMs via SSH. As an Emacs user, I'm considering to get everything done without leaving Emacs.

So far I've met two problems:

1. ssh -A
   ssh -A does agent forwarding, but I can't find the EShell equivalent by searching the Emacs Info.

   How do you achieve the same effect of ssh -A in Emacs?

2. cd /
   After `cd /ssh:username@host', `cd /' will change directory to / of my local machine.
   Is there any way to make EShell behave like a ordinary bash sshed to a remote machine?


Thanks and regards,
Wenshan


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

* Re: EShell tips on SSH?
  2013-01-15  0:13 EShell tips on SSH? Wenshan Ren
@ 2013-01-15  7:32 ` Bob Proulx
  2013-01-15  7:38 ` Michael Albinus
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Bob Proulx @ 2013-01-15  7:32 UTC (permalink / raw
  To: Wenshan Ren; +Cc: help-gnu-emacs

Wenshan Ren wrote:
> I manage a few VMs via SSH. As an Emacs user, I'm considering to get
> everything done without leaving Emacs.

Sure.

> So far I've met two problems:
> 
> 1. ssh -A
>    ssh -A does agent forwarding, but I can't find the EShell
>    equivalent by searching the Emacs Info.

How are you invoking ssh?

My first thought is the use of the emacs "tramp" module.  This is
quite well documented and very useful.  If you are using tramp please
say so.  If you are not using tramp then look up the documentation and
read up on tramp.  You will like it.

>    How do you achieve the same effect of ssh -A in Emacs?

I don't recommend to forward your agent.  If you do forward your agent
only forward it to systems that you trust.  Because root on the remote
system can make use of your forwarded agent.

If you do want to forward your agent anyway I would set it up to do so
in your ssh configuration file.  That would avoid the need for a
command line option.  Then when Emacs and Tramp use ssh it will get
the agent forwarding because of the ssh configuration.  Something like
this usually in your $HOME/.ssh/config file:

  Host foo.example.com
    ForwardAgent yes

If you do this then your ssh-agent will be forwarded through tramp
shell and tramp eshell sessions.  I tested this just now and it worked
okay for me.

> 2. cd /
>    After `cd /ssh:username@host', `cd /' will change directory to /
>    of my local machine.  Is there any way to make EShell behave like
>    a ordinary bash sshed to a remote machine?

I think the idea for "cd" in eshell is that "/ssh:username@host" is
just a directory path like any other.  Therefore "cd /" will also be a
path like any other.  It isn't special.  It isn't a chroot.

Even if you use "shell" (instead of "eshell") you are still inside
emacs.  I note that with shell doing "cd /" will stay on the remote
machine and won't crawl out of the facade.  I am not arguing against
eshell.  But just sayhing that shell implements this feature as you
wish it.  If you use shell then you will be ssh'd into the machine and
cd / will take you to the root of the remote machine as you desire.

Bob




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

* Re: EShell tips on SSH?
  2013-01-15  0:13 EShell tips on SSH? Wenshan Ren
  2013-01-15  7:32 ` Bob Proulx
@ 2013-01-15  7:38 ` Michael Albinus
       [not found] ` <mailman.17475.1358235159.855.help-gnu-emacs@gnu.org>
       [not found] ` <mailman.17476.1358235541.855.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Albinus @ 2013-01-15  7:38 UTC (permalink / raw
  To: Wenshan Ren; +Cc: help-gnu-emacs

Wenshan Ren <renws1990@gmail.com> writes:

> Hi,

Hi,

> I manage a few VMs via SSH. As an Emacs user, I'm considering to get
> everything done without leaving Emacs.
>
> So far I've met two problems:
>
> 1. ssh -A
>    ssh -A does agent forwarding, but I can't find the EShell
> equivalent by searching the Emacs Info.
>
>    How do you achieve the same effect of ssh -A in Emacs?

If you use the remote file name syntax, the underlying operations are
directed to Tramp. You could redefine Tramp's method definition in order
to add "-A" to the ssh call. See variable `tramp-methods'.

The better solution would be to add the following entry to your
~/.ssh/config:

Host remotehost
	ForwardAgent	yes

> 2. cd /
>    After `cd /ssh:username@host', `cd /' will change directory to / of
> my local machine.
>    Is there any way to make EShell behave like a ordinary bash sshed
> to a remote machine?

Eshell is designed that file names used by "cd" work as everywhere else
in Emacs. The usual workaround "*cd /" to apply the corresponding
external command does not work, because "cd" is not related to an
executable file, but a shell built-in. What you ask for does not seem to
be possible in eshell yet. Maybe we should add a new eshell command
"chroot". Something like

chroot /ssh:username@host:/

Feel free to raise a change request towards Emacs/eshell via
`report-emacs-bug'.

> Thanks and regards,
> Wenshan

Best regards, Michael.



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

* Re: EShell tips on SSH?
       [not found] ` <mailman.17475.1358235159.855.help-gnu-emacs@gnu.org>
@ 2013-01-15 23:09   ` Wenshan Ren
  0 siblings, 0 replies; 5+ messages in thread
From: Wenshan Ren @ 2013-01-15 23:09 UTC (permalink / raw
  To: help-gnu-emacs; +Cc: help-gnu-emacs, Wenshan Ren

On Tuesday, January 15, 2013 6:32:34 PM UTC+11, Bob Proulx wrote:
> Wenshan Ren wrote:
> 
> > I manage a few VMs via SSH. As an Emacs user, I'm considering to get
> 
> > everything done without leaving Emacs.
> 
> 
> 
> Sure.
> 
> 
> 
> > So far I've met two problems:
> 
> > 
> 
> > 1. ssh -A
> 
> >    ssh -A does agent forwarding, but I can't find the EShell
> 
> >    equivalent by searching the Emacs Info.
> 
> 
> 
> How are you invoking ssh?
> 
> 
> 
> My first thought is the use of the emacs "tramp" module.  This is
> 
> quite well documented and very useful.  If you are using tramp please
> 
> say so.  If you are not using tramp then look up the documentation and
> 
> read up on tramp.  You will like it.
> 
> 
> 
> >    How do you achieve the same effect of ssh -A in Emacs?
> 
> 
> 
> I don't recommend to forward your agent.  If you do forward your agent
> 
> only forward it to systems that you trust.  Because root on the remote
> 
> system can make use of your forwarded agent.
> 
> 
> 
> If you do want to forward your agent anyway I would set it up to do so
> 
> in your ssh configuration file.  That would avoid the need for a
> 
> command line option.  Then when Emacs and Tramp use ssh it will get
> 
> the agent forwarding because of the ssh configuration.  Something like
> 
> this usually in your $HOME/.ssh/config file:
> 
> 
> 
>   Host foo.example.com
> 
>     ForwardAgent yes
> 
> 
> 
> If you do this then your ssh-agent will be forwarded through tramp
> 
> shell and tramp eshell sessions.  I tested this just now and it worked
> 
> okay for me.
> 
> 
> 

Yes, I invoke ssh using tramp so I can edit files on remote machines with my beloved and well configured editor.

Putting FowardAgent yes in ~/.ssh/config works :) 

> > 2. cd /
> 
> >    After `cd /ssh:username@host', `cd /' will change directory to /
> 
> >    of my local machine.  Is there any way to make EShell behave like
> 
> >    a ordinary bash sshed to a remote machine?
> 
> 
> 
> I think the idea for "cd" in eshell is that "/ssh:username@host" is
> 
> just a directory path like any other.  Therefore "cd /" will also be a
> 
> path like any other.  It isn't special.  It isn't a chroot.
> 
> 
> 
> Even if you use "shell" (instead of "eshell") you are still inside
> 
> emacs.  I note that with shell doing "cd /" will stay on the remote
> 
> machine and won't crawl out of the facade.  I am not arguing against
> 
> eshell.  But just sayhing that shell implements this feature as you
> 
> wish it.  If you use shell then you will be ssh'd into the machine and
> 
> cd / will take you to the root of the remote machine as you desire.
> 
> 

Got it, I will raise a change request as Michael suggested.

> 
> Bob


Thank you very much, Bob.


- Wenshan


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

* Re: EShell tips on SSH?
       [not found] ` <mailman.17476.1358235541.855.help-gnu-emacs@gnu.org>
@ 2013-01-15 23:12   ` Wenshan Ren
  0 siblings, 0 replies; 5+ messages in thread
From: Wenshan Ren @ 2013-01-15 23:12 UTC (permalink / raw
  To: help-gnu-emacs; +Cc: help-gnu-emacs, Wenshan Ren

On Tuesday, January 15, 2013 6:38:48 PM UTC+11, Michael Albinus wrote:
> Wenshan Ren <renws1990@gmail.com> writes:
> 
> 
> 
> > Hi,
> 
> 
> 
> Hi,
> 
> 
> 
> > I manage a few VMs via SSH. As an Emacs user, I'm considering to get
> 
> > everything done without leaving Emacs.
> 
> >
> 
> > So far I've met two problems:
> 
> >
> 
> > 1. ssh -A
> 
> >    ssh -A does agent forwarding, but I can't find the EShell
> 
> > equivalent by searching the Emacs Info.
> 
> >
> 
> >    How do you achieve the same effect of ssh -A in Emacs?
> 
> 
> 
> If you use the remote file name syntax, the underlying operations are
> 
> directed to Tramp. You could redefine Tramp's method definition in order
> 
> to add "-A" to the ssh call. See variable `tramp-methods'.
> 
> 
> 
> The better solution would be to add the following entry to your
> 
> ~/.ssh/config:
> 
> 
> 
> Host remotehost
> 
> 	ForwardAgent	yes
> 
> 
> 
> > 2. cd /
> 
> >    After `cd /ssh:username@host', `cd /' will change directory to / of
> 
> > my local machine.
> 
> >    Is there any way to make EShell behave like a ordinary bash sshed
> 
> > to a remote machine?
> 
> 
> 
> Eshell is designed that file names used by "cd" work as everywhere else
> 
> in Emacs. The usual workaround "*cd /" to apply the corresponding
> 
> external command does not work, because "cd" is not related to an
> 
> executable file, but a shell built-in. What you ask for does not seem to
> 
> be possible in eshell yet. Maybe we should add a new eshell command
> 
> "chroot". Something like
> 
> 
> 
> chroot /ssh:username@host:/
> 
> 
> 
> Feel free to raise a change request towards Emacs/eshell via
> 
> `report-emacs-bug'.
> 
> 
> 
> > Thanks and regards,
> 
> > Wenshan
> 
> 
> 
> Best regards, Michael.

Thanks for your reply, it really makes sense to me and I will raise a change request.


- Wenshan


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

end of thread, other threads:[~2013-01-15 23:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15  0:13 EShell tips on SSH? Wenshan Ren
2013-01-15  7:32 ` Bob Proulx
2013-01-15  7:38 ` Michael Albinus
     [not found] ` <mailman.17475.1358235159.855.help-gnu-emacs@gnu.org>
2013-01-15 23:09   ` Wenshan Ren
     [not found] ` <mailman.17476.1358235541.855.help-gnu-emacs@gnu.org>
2013-01-15 23:12   ` Wenshan Ren

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.