Loading ...
Sorry, an error occurred while loading the content.

scp:// over multiple hops

Expand Messages
  • Dado Feigenblatt
    I usually don t do things like this, but it really seems that my question went totally unoticed, so I ll post it again. If no one picks it up this time I ll
    Message 1 of 8 , May 29, 2002
    • 0 Attachment
      I usually don't do things like this, but it really seems that my
      question went totally unoticed, so I'll post it again.
      If no one picks it up this time I'll shut up.
      Sorry for the extra noise.

      The question is:

      To log to my network at work I have to go through 2 ssh conections:
      ssh user1@machine1 and from there ssh user2@machine2, where users and
      passwords are different.
      Is it possible to use scp:// to edit a file over that configuration?
      Something like :e scp://user1@machine1/scp://user2@machine2/path ?

      A friend from work does that using xemacs and tramp
      (http://tramp.sf.net), which I think is a plugin written in LISP.
      I'm not an emacs or LISP person.

      Is there anything like that in vim, either built in or as a plugin?

      Thanks.


      --
      Dado Feigenblatt Wild Brain, Inc.
      Technical Director (415) 553-8000
      dado@... San Francisco, CA.
    • Claudio Fleiner
      The simplest way is to use creative port forwarding with ssh. Basically, use the first ssh to forward a localport to the second ssh server (warning: this may
      Message 2 of 8 , May 29, 2002
      • 0 Attachment
        The simplest way is to use creative port forwarding with ssh.
        Basically, use the first ssh to forward a localport to the
        second ssh server (warning: this may violate some policies
        of your company!)

        Something like the following should do the trick (and assumes
        that you don't run a local ssh client, otherwise you need to
        change the port):

        ssh -L 22:machine2:22 user1@machine1

        now

        scp://user2@localhost/path

        should allow you to edit your file.

        Claudio

        on 29 May 2002 18:25:00 -0700 Dado Feigenblatt <vim@...> wrote:
        DF> I usually don't do things like this, but it really seems that my
        DF> question went totally unoticed, so I'll post it again.
        DF> If no one picks it up this time I'll shut up.
        DF> Sorry for the extra noise.
        DF>
        DF> The question is:
        DF>
        DF> To log to my network at work I have to go through 2 ssh conections:
        DF> ssh user1@machine1 and from there ssh user2@machine2, where users and
        DF> passwords are different.
        DF> Is it possible to use scp:// to edit a file over that configuration?
        DF> Something like :e scp://user1@machine1/scp://user2@machine2/path ?
        DF>
        DF> A friend from work does that using xemacs and tramp
        DF> (http://tramp.sf.net), which I think is a plugin written in LISP.
        DF> I'm not an emacs or LISP person.
        DF>
        DF> Is there anything like that in vim, either built in or as a plugin?
        DF>
        DF> Thanks.
        DF>
        DF>
        DF> --
        DF> Dado Feigenblatt Wild Brain, Inc.
        DF> Technical Director (415) 553-8000
        DF> dado@... San Francisco, CA.
        DF>

        ----------------------------------------------------------------------------
        Claudio Fleiner claudio@...
      • Stephen Rasku
        ... I don t think that this will work unless you are root. I don t think ssh will allow you to forward privileged ports (those under 1024) unless you are
        Message 3 of 8 , May 30, 2002
        • 0 Attachment
          Dado Feigenblatt wrote:

          >
          >The simplest way is to use creative port forwarding with ssh.
          >Basically, use the first ssh to forward a localport to the
          >second ssh server (warning: this may violate some policies
          >of your company!)
          >
          >Something like the following should do the trick (and assumes
          >that you don't run a local ssh client, otherwise you need to
          >change the port):
          >
          > ssh -L 22:machine2:22 user1@machine1
          >
          >now
          >
          > scp://user2@localhost/path
          >
          >should allow you to edit your file.

          I don't think that this will work unless you are root. I don't think
          ssh will allow you to forward "privileged" ports (those under 1024)
          unless you are root.

          --
          Stephen Rasku E-mail: stephen@...
          Senior Software Engineer Web: http://www.pop-star.net/
          TGI Technologies
        • Dado Feigenblatt
          ... Thanks for the replies. I ve tried Claudio s suggestion and it kind of worked. One thing I didn t mention is that I m running W2K at home. My Linux
          Message 4 of 8 , May 31, 2002
          • 0 Attachment
            On Thu, 2002-05-30 at 12:21, Stephen Rasku wrote:
            > Dado Feigenblatt wrote:
            > 
            > >
            > >The simplest way is to use creative port forwarding with ssh.
            > >Basically, use the first ssh to forward a localport to the
            > >second ssh server (warning: this may violate some policies
            > >of your company!)
            > >
            > >Something like the following should do the trick (and assumes
            > >that you don't run a local ssh client, otherwise you need to
            > >change the port):
            > >
            > >        ssh -L 22:machine2:22 user1@machine1
            > >
            > >now 
            > >
            > >        scp://user2@localhost/path
            > >
            > >should allow you to edit your file.
            > 
            > I don't think that this will work unless you are root.  I don't think 
            > ssh will allow you to forward "privileged" ports (those under 1024) 
            > unless you are root.
            > 
            > -- 
            > Stephen Rasku			E-mail:	stephen@...
            > Senior Software Engineer	Web:	http://www.pop-star.net/
            > TGI Technologies

            Thanks for the replies.
            I've tried Claudio's suggestion and it kind of worked.
            One thing I didn't mention is that I'm running W2K at home.
            My Linux partition is hosed and needs to be rebuilt from scratch :(

            I have CYGWIN installed and I got scp to work in tcsh.
            On a shell I did scp dado@localhost:.tcshrc . and had that file copied from my home dir at work to my local dir at home.

            scp dado@localhost:.tcshrc .
            dado@localhost's password:
            .tcshrc              100% |*****************************|  2639   00:00

            But I couldn't get that to work in VIM.

            On WIN32 GVIM it would pop a DOS prompt window with this:
            tcsh -c "scp dado@localhost:.tcshrc  c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/VIC329.tmp"
            dado@localhost's password:
            ssh: c: Name or service not known
            lost connection
            Hit any key to close this window...

            On CYGWIN VIM, it doesn't do anything but create a new buffer with a new file:
            "scp://dado@localhost/.tcshrc:" [New File]

            Any idea?
            Thanks a lot.
            -- 
            Dado Feigenblatt                                 Wild Brain, Inc.   
            Technical Director                               (415) 553-8000
            dado@...                               San Francisco, CA.
          • Colin Keith
            ... Which isn t anything to do with vim, but because : is taken by openssh s scp to mean connect to hostname . (If you need to get around this, get the
            Message 5 of 8 , May 31, 2002
            • 0 Attachment
              On Fri, May 31, 2002 at 01:29:32PM -0700, Dado Feigenblatt wrote:
              > On WIN32 GVIM it would pop a DOS prompt window with this:
              > tcsh -c "scp dado@localhost:.tcshrc
              > c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/VIC329.tmp"
              > dado@localhost's password:
              > ssh: c: Name or service not known

              Which isn't anything to do with vim, but because <x>: is taken by openssh's
              scp to mean connect to hostname <x>. (If you need to get around this, get the
              windows SSH clients from SSH Corp) However the netrw.vim packages is clever
              and replaces the c:\ with //c/. I.e.:

              let cygtmpfile=substitute(tmpfile,'^\(\a\):','//\1/','e')

              => C:\WINNT\system32\cmd.exe /c scp colin@www1:index.html \
              //C/\DOCUME~1\colin\LOCALS~1\Temp\VIBD5.tmp

              What are you typing in exactly?

              > On CYGWIN VIM, it doesn't do anything but create a new buffer with a new
              > file:
              > "scp://dado@localhost/.tcshrc:" [New File]

              Hmmm, it does doesn't it. Try:

              :set nocp

              That fixed it for cygwin vim for me.

              Colin.
            • Charles E. Campbell
              ... All you re supposed to have to do is: [g]vim scp://dado@localhost/.tcshrc ... Now I admit that I use bash rather than tcsh. With bash/cygwin my settings
              Message 6 of 8 , May 31, 2002
              • 0 Attachment
                On Fri, May 31, 2002 at 01:29:32PM -0700, Dado Feigenblatt wrote:
                > scp dado@localhost:.tcshrc .
                > dado@localhost's password:
                > .tcshrc 100% |*****************************| 2639 00:00
                >
                > But I couldn't get that to work in VIM.

                All you're supposed to have to do is:

                [g]vim scp://dado@localhost/.tcshrc

                > Any idea?

                Now I admit that I use bash rather than tcsh. With bash/cygwin
                my settings are:

                set shell=bash
                set shq= " shell quote around command passed to shell for ! and :!, no redirection
                set sxq=\" " shell x quote: for ! and :! including redirection
                set ssl " shellslash: when set, a forward slash used to expand filenames
                set shcf=-c " shellcmdflag: flag passed to shell to execute ! and :!
                set sp=>& " shellpipe: string to be used to put :make output into error file

                Regards,
                C Campbell

                --
                Charles E Campbell, Jr, PhD _ __ __
                Goddard Space Flight Center / /_/\_\_/ /
                cec@... /_/ \/_//_/
                PGP public key: http://www.erols.com/astronaut/pgp.html
              • Andrew Francis
                ... openssh s ... the ... I use the pscp program, which is part of the PuTTY collection. It s a much smaller download than the ssh.com package (a few hundred
                Message 7 of 8 , Jun 1, 2002
                • 0 Attachment
                  "Colin Keith" <vim@...> wrote:
                  > Which isn't anything to do with vim, but because <x>: is taken by
                  openssh's
                  > scp to mean connect to hostname <x>. (If you need to get around this, get
                  the
                  > windows SSH clients from SSH Corp)

                  I use the "pscp" program, which is part of the PuTTY collection. It's
                  a much smaller download than the ssh.com package (a few hundred kilobytes,
                  versus 6 megs :).

                  > However the netrw.vim packages is clever
                  > and replaces the c:\ with //c/. I.e.:


                  I don't think this will work on a default cygwin install... you need to
                  change the path from <drive>:\path1\path2\... to
                  //cygdrive/<drive>/path1/path2/... overall, I'd just recommend using pscp :)

                  --
                  Andrew Francis | To email me, get | ASCII ribbon campaign ( )
                  Perth, Australia | the real address | against HTML email X
                  http://www.sullust.net/ | from my homepage | http://arc.pasp.de/ / \
                • Colin Keith
                  ... On topic: We just had this topic covered on a thread last week. I believe that the netrw module has now been updated? Whatever, //c/ works on my cygwin
                  Message 8 of 8 , Jun 1, 2002
                  • 0 Attachment
                    On Sat, Jun 01, 2002 at 03:14:51PM +0800, Andrew Francis wrote:
                    > I don't think this will work on a default cygwin install... you need to
                    > change the path from <drive>:\path1\path2\... to
                    > //cygdrive/<drive>/path1/path2/... overall, I'd just recommend using pscp :)

                    On topic:
                    We just had this topic covered on a thread last week. I believe that the
                    netrw module has now been updated? Whatever, //c/ works on my cygwin
                    which is about a month old.

                    Slightly off topic:
                    I always found pscp hung when talking to OpenSSH servers running SSH2 *shrug*
                    But I haven't tested it in 6 months, so maybe its fine :)
                  Your message has been successfully submitted and would be delivered to recipients shortly.