netrw and tunneling

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

netrw and tunneling

Walter Cazzola-2
Dear Vimmers,
I'm in the situation where I've to remotely administer a server and I would
like to edit the files on my machine via netrw.

I'm already used to "gvim scp://host+path" but in this case the remote server
can be accessed only through one other machine and I've to do a tunnel to edit
them.

I've already tried to add to my .vimrc

   let g:netrw_scp_cmd="scp -q -oProxyCommand=\"ssh -W %h:%p tunnel-host\""

but it didn't work. I googled around but seems that this problem never raised.

I'm still on vim 7.4 and I'm using a version of openssh older than 7.3 (this
is why I'm still using ProxyCommand instead of ProxyJump). Unfortunately to
update my linux-box is not an option in the near future.

Any idea?

Thank you
Walter

--

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/alpine.LFD.2.20.1908091217110.6718%40hymir.docenti.di.unimi.it.
Reply | Threaded
Open this post in threaded view
|

Re: netrw and tunneling

Grant Taylor-2
On 8/9/19 4:17 AM, Walter Cazzola wrote:

> I'm already used to "gvim scp://host+path" but in this case the remote
> server can be accessed only through one other machine and I've to do a
> tunnel to edit them.
>
> I've already tried to add to my .vimrc
>
>    let g:netrw_scp_cmd="scp -q -oProxyCommand=\"ssh -W %h:%p tunnel-host\""
>
> but it didn't work. I googled around but seems that this problem never
> raised.
>
> I'm still on vim 7.4 and I'm using a version of openssh older
> than 7.3 (this is why I'm still using ProxyCommand instead of
> ProxyJump). Unfortunately to update my linux-box is not an option in
> the near future.
>
> Any idea?

Yes.

Teach OpenSSH how to get to the host by putting entries in the OpenSSH
/client/ configuration file; ~/.ssh/config or system wide
/etc/ssh/ssh_config. E.g.

Host targetHost
        ProxyCommand ssh -W %h:%p tunnel-host

Host tunnel-host
        # any options you might want here

This teaches any and all OpenSSH clients how to get to targetHost
without needing to specify additional command line options.  I.e. you
can run the following command:

    gvim scp://targetHost+path

(G)vim doesn't need to worry about /how/ scp connects.  OpenSSH's scp
command deals with that transparently.

IMHO the OpenSSH /client/ configuration file opens up a world of
possibilities.

Link - Empowering OpenSSH
  -
https://dotfiles.tnetconsulting.net/articles/2015/0506/empowering-openssh.html



--
Grant. . . .
unix || die

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/303379b3-8f69-7dbd-cb9a-ab3f20fd1073%40spamtrap.tnetconsulting.net.
Reply | Threaded
Open this post in threaded view
|

Re: [VIM] Re: netrw and tunneling

Walter Cazzola-2
On Fri, 9 Aug 2019, 'Grant Taylor' via vim_use wrote:

>>  Any idea?

> Yes.

> Teach OpenSSH how to get to the host by putting entries in the OpenSSH
> /client/ configuration file; ~/.ssh/config or system wide
> /etc/ssh/ssh_config. E.g.

> Host targetHost
> ProxyCommand ssh -W %h:%p tunnel-host

> Host tunnel-host
> # any options you might want here

> This teaches any and all OpenSSH clients how to get to targetHost without
> needing to specify additional command line options.  I.e. you can run the
> following command:

>   gvim scp://targetHost+path

> (G)vim doesn't need to worry about /how/ scp connects.  OpenSSH's scp command
> deals with that transparently.

Good suggestion but isn't this forcing any ssh connection to pass through the
tunnel? I would prefer something less radical or that, at least, I can easily
switch off without touching every time the ssh configuration.

Walter

--

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/alpine.LFD.2.20.1908091854360.6718%40hymir.docenti.di.unimi.it.
Reply | Threaded
Open this post in threaded view
|

Re: [VIM] Re: netrw and tunneling

Richard Mitchell
On Friday, August 9, 2019 at 1:12:55 PM UTC-4, Walter Cazzola wrote:

> On Fri, 9 Aug 2019, 'Grant Taylor' via vim_use wrote:
>
> >>  Any idea?
>
> > Yes.
>
> > Teach OpenSSH how to get to the host by putting entries in the OpenSSH
> > /client/ configuration file; ~/.ssh/config or system wide
> > /etc/ssh/ssh_config. E.g.
>
> > Host targetHost
> > ProxyCommand ssh -W %h:%p tunnel-host
>
> > Host tunnel-host
> > # any options you might want here
>
> > This teaches any and all OpenSSH clients how to get to targetHost without
> > needing to specify additional command line options.  I.e. you can run the
> > following command:
>
> >   gvim scp://targetHost+path
>
> > (G)vim doesn't need to worry about /how/ scp connects.  OpenSSH's scp command
> > deals with that transparently.
>
> Good suggestion but isn't this forcing any ssh connection to pass through the
> tunnel? I would prefer something less radical or that, at least, I can easily
> switch off without touching every time the ssh configuration.
>
> Walter
>
> --
The tunnel would only be used for that host, which you already have to get to by going through the intermediate host.  It isn't going to force other hosts to go through the same intermediate host.

Regardless, "Host" is only an alias.  Call it whatever you want and use it just for vi.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/72796b33-4c66-45ac-9a7a-b637e00ab4c1%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: [VIM] Re: netrw and tunneling

Grant Taylor-2
On 8/9/19 12:08 PM, Richard Mitchell wrote:
> The tunnel would only be used for that host, which you already have
> to get to by going through the intermediate host.  It isn't going to
> force other hosts to go through the same intermediate host.

Correct.

> Regardless, "Host" is only an alias.  Call it whatever you want and
> use it just for vi.

Not quite.  "Host" is how you define a set of entries that are for a
specific host.  The "targetHost" and "tunnel-host" are the names / aliases.

The example ProxyCommand line is associated with the host entry named
"targetHost".  Meaning that ssh / scp / sftp to targetHost will use the
entries under the "Host targetHost" line.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/97cf03be-3e79-7e53-3fcf-d91420bb91a6%40spamtrap.tnetconsulting.net.
Reply | Threaded
Open this post in threaded view
|

Re: [VIM] Re: netrw and tunneling

Richard Mitchell
On Friday, August 9, 2019 at 10:32:18 PM UTC-4, Grant Taylor wrote:

> On 8/9/19 12:08 PM, Richard Mitchell wrote:
> > The tunnel would only be used for that host, which you already have
> > to get to by going through the intermediate host.  It isn't going to
> > force other hosts to go through the same intermediate host.
>
> Correct.
>
> > Regardless, "Host" is only an alias.  Call it whatever you want and
> > use it just for vi.
>
> Not quite.  "Host" is how you define a set of entries that are for a
> specific host.  The "targetHost" and "tunnel-host" are the names / aliases.
>
> The example ProxyCommand line is associated with the host entry named
> "targetHost".  Meaning that ssh / scp / sftp to targetHost will use the
> entries under the "Host targetHost" line.
Yes, I just meant if he was concerned about unintentional use of the tunnel, he could give it a specific Host name that he only used with vi commands.  Certainly that name and its associated configuration would be available to ssh/scp/rsync/etc if he used that name with those commands, but he could use names (say with _vi appended) that he only used with vi.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/04e70740-0c07-48de-b917-d64399fd92e1%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: [VIM] Re: netrw and tunneling

Grant Taylor-2
On 8/9/19 9:07 PM, Richard Mitchell wrote:
> Yes, I just meant if he was concerned about unintentional use of the
> tunnel, he could give it a specific Host name that he only used with
> vi commands.  Certainly that name and its associated configuration
> would be available to ssh/scp/rsync/etc if he used that name with
> those commands, but he could use names (say with _vi appended) that
> he only used with vi.

Ah.  Agreed.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/c3f9ed1f-af35-5283-349b-d5972fee2e9e%40spamtrap.tnetconsulting.net.