sshfs through two hops?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I want to mount a folder in a remote location to /mnt/volume on my mac but this folder is usually accessed through a login server myname@server-login.com using SSH like ssh -A -Y -o myname@server-login.com (the -A is necessary as it uses the same SSH key for subsequent hops) and then once on this server I do ssh -A -Y -o myname@server-main.com. I want to mount a folder in this server-main to my mac. How do I do this?



I have verified I can mount a folder on the server-login like so:
sudo sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/id_rsa myname@server-login.com:/home/users/myname /mnt/volume
So my sshfs is working.



I tried this method https://www.larkinweb.co.uk/computing/mounting_file_systems_over_two_ssh_hops.html
Where I did ssh -f myname@server-login.com -L 2223:server-main.com:22 -N
and then sudo sshfs -p 2223 myname@server-main.com:/ /mnt/volume
But it comes back with remote host has disconnected.










share|improve this question



























    up vote
    0
    down vote

    favorite












    I want to mount a folder in a remote location to /mnt/volume on my mac but this folder is usually accessed through a login server myname@server-login.com using SSH like ssh -A -Y -o myname@server-login.com (the -A is necessary as it uses the same SSH key for subsequent hops) and then once on this server I do ssh -A -Y -o myname@server-main.com. I want to mount a folder in this server-main to my mac. How do I do this?



    I have verified I can mount a folder on the server-login like so:
    sudo sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/id_rsa myname@server-login.com:/home/users/myname /mnt/volume
    So my sshfs is working.



    I tried this method https://www.larkinweb.co.uk/computing/mounting_file_systems_over_two_ssh_hops.html
    Where I did ssh -f myname@server-login.com -L 2223:server-main.com:22 -N
    and then sudo sshfs -p 2223 myname@server-main.com:/ /mnt/volume
    But it comes back with remote host has disconnected.










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I want to mount a folder in a remote location to /mnt/volume on my mac but this folder is usually accessed through a login server myname@server-login.com using SSH like ssh -A -Y -o myname@server-login.com (the -A is necessary as it uses the same SSH key for subsequent hops) and then once on this server I do ssh -A -Y -o myname@server-main.com. I want to mount a folder in this server-main to my mac. How do I do this?



      I have verified I can mount a folder on the server-login like so:
      sudo sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/id_rsa myname@server-login.com:/home/users/myname /mnt/volume
      So my sshfs is working.



      I tried this method https://www.larkinweb.co.uk/computing/mounting_file_systems_over_two_ssh_hops.html
      Where I did ssh -f myname@server-login.com -L 2223:server-main.com:22 -N
      and then sudo sshfs -p 2223 myname@server-main.com:/ /mnt/volume
      But it comes back with remote host has disconnected.










      share|improve this question















      I want to mount a folder in a remote location to /mnt/volume on my mac but this folder is usually accessed through a login server myname@server-login.com using SSH like ssh -A -Y -o myname@server-login.com (the -A is necessary as it uses the same SSH key for subsequent hops) and then once on this server I do ssh -A -Y -o myname@server-main.com. I want to mount a folder in this server-main to my mac. How do I do this?



      I have verified I can mount a folder on the server-login like so:
      sudo sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/id_rsa myname@server-login.com:/home/users/myname /mnt/volume
      So my sshfs is working.



      I tried this method https://www.larkinweb.co.uk/computing/mounting_file_systems_over_two_ssh_hops.html
      Where I did ssh -f myname@server-login.com -L 2223:server-main.com:22 -N
      and then sudo sshfs -p 2223 myname@server-main.com:/ /mnt/volume
      But it comes back with remote host has disconnected.







      linux ssh mount ssh-tunneling sshfs






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 days ago









      Rui F Ribeiro

      38.2k1475123




      38.2k1475123










      asked 2 days ago









      ru111

      343




      343




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          In the article you are quoting there are two commands. The first,



          $ ssh -f userB@systemB -L 2222:systemC:22 -N


          establishes a tunnel between the local host and systemB; requests made to localhost:2222 are forwarded to port 22 on systemC.



          Hence, to mount the /remote/path/ (that sits on systemC) on localhost you have to connect to localhost:2222, as in the second command:



          $ sshfs -p 2222 userC@localhost:/remote/path/ /mnt/localpath/


          But in your question you are trying to connect to systemC:2223.

          It should be, instead:



          $ ssh -f myname@server-login.com -L 2223:server-main.com:22 -N
          $ sudo sshfs -p 2223 myname@localhost:/ /mnt/volume





          share|improve this answer




















          • Thanks - I think I can use 2222 actually. So because I want mount a specific folder accessed through server-main, I did sudo sshfs -p 2222 myname@localhost:/group/data /mnt/volume. It did something, but now I can't access the folder on my mac - /mnt/volume disappears and accessing through the command line it gives me "no such file or directory". Unmounting brings me back the folder...
            – ru111
            2 days ago











          • 1) Port: you can choose the one you like most, as long as it's not already in use. 2) You probably don't want to run sshfs as root; you can run it as your user, just make sure to pick as mount point a directory you can write to (other users won't be able to access it). 3) That is how mounting works: on /mnt/volume/ you will have the remote, mounted, directory, and the local content of /mnt/volume will not be accessible. Choose a different mount point if this is a problem.
            – fra-san
            2 days ago











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f482147%2fsshfs-through-two-hops%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          In the article you are quoting there are two commands. The first,



          $ ssh -f userB@systemB -L 2222:systemC:22 -N


          establishes a tunnel between the local host and systemB; requests made to localhost:2222 are forwarded to port 22 on systemC.



          Hence, to mount the /remote/path/ (that sits on systemC) on localhost you have to connect to localhost:2222, as in the second command:



          $ sshfs -p 2222 userC@localhost:/remote/path/ /mnt/localpath/


          But in your question you are trying to connect to systemC:2223.

          It should be, instead:



          $ ssh -f myname@server-login.com -L 2223:server-main.com:22 -N
          $ sudo sshfs -p 2223 myname@localhost:/ /mnt/volume





          share|improve this answer




















          • Thanks - I think I can use 2222 actually. So because I want mount a specific folder accessed through server-main, I did sudo sshfs -p 2222 myname@localhost:/group/data /mnt/volume. It did something, but now I can't access the folder on my mac - /mnt/volume disappears and accessing through the command line it gives me "no such file or directory". Unmounting brings me back the folder...
            – ru111
            2 days ago











          • 1) Port: you can choose the one you like most, as long as it's not already in use. 2) You probably don't want to run sshfs as root; you can run it as your user, just make sure to pick as mount point a directory you can write to (other users won't be able to access it). 3) That is how mounting works: on /mnt/volume/ you will have the remote, mounted, directory, and the local content of /mnt/volume will not be accessible. Choose a different mount point if this is a problem.
            – fra-san
            2 days ago















          up vote
          0
          down vote













          In the article you are quoting there are two commands. The first,



          $ ssh -f userB@systemB -L 2222:systemC:22 -N


          establishes a tunnel between the local host and systemB; requests made to localhost:2222 are forwarded to port 22 on systemC.



          Hence, to mount the /remote/path/ (that sits on systemC) on localhost you have to connect to localhost:2222, as in the second command:



          $ sshfs -p 2222 userC@localhost:/remote/path/ /mnt/localpath/


          But in your question you are trying to connect to systemC:2223.

          It should be, instead:



          $ ssh -f myname@server-login.com -L 2223:server-main.com:22 -N
          $ sudo sshfs -p 2223 myname@localhost:/ /mnt/volume





          share|improve this answer




















          • Thanks - I think I can use 2222 actually. So because I want mount a specific folder accessed through server-main, I did sudo sshfs -p 2222 myname@localhost:/group/data /mnt/volume. It did something, but now I can't access the folder on my mac - /mnt/volume disappears and accessing through the command line it gives me "no such file or directory". Unmounting brings me back the folder...
            – ru111
            2 days ago











          • 1) Port: you can choose the one you like most, as long as it's not already in use. 2) You probably don't want to run sshfs as root; you can run it as your user, just make sure to pick as mount point a directory you can write to (other users won't be able to access it). 3) That is how mounting works: on /mnt/volume/ you will have the remote, mounted, directory, and the local content of /mnt/volume will not be accessible. Choose a different mount point if this is a problem.
            – fra-san
            2 days ago













          up vote
          0
          down vote










          up vote
          0
          down vote









          In the article you are quoting there are two commands. The first,



          $ ssh -f userB@systemB -L 2222:systemC:22 -N


          establishes a tunnel between the local host and systemB; requests made to localhost:2222 are forwarded to port 22 on systemC.



          Hence, to mount the /remote/path/ (that sits on systemC) on localhost you have to connect to localhost:2222, as in the second command:



          $ sshfs -p 2222 userC@localhost:/remote/path/ /mnt/localpath/


          But in your question you are trying to connect to systemC:2223.

          It should be, instead:



          $ ssh -f myname@server-login.com -L 2223:server-main.com:22 -N
          $ sudo sshfs -p 2223 myname@localhost:/ /mnt/volume





          share|improve this answer












          In the article you are quoting there are two commands. The first,



          $ ssh -f userB@systemB -L 2222:systemC:22 -N


          establishes a tunnel between the local host and systemB; requests made to localhost:2222 are forwarded to port 22 on systemC.



          Hence, to mount the /remote/path/ (that sits on systemC) on localhost you have to connect to localhost:2222, as in the second command:



          $ sshfs -p 2222 userC@localhost:/remote/path/ /mnt/localpath/


          But in your question you are trying to connect to systemC:2223.

          It should be, instead:



          $ ssh -f myname@server-login.com -L 2223:server-main.com:22 -N
          $ sudo sshfs -p 2223 myname@localhost:/ /mnt/volume






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 days ago









          fra-san

          586210




          586210











          • Thanks - I think I can use 2222 actually. So because I want mount a specific folder accessed through server-main, I did sudo sshfs -p 2222 myname@localhost:/group/data /mnt/volume. It did something, but now I can't access the folder on my mac - /mnt/volume disappears and accessing through the command line it gives me "no such file or directory". Unmounting brings me back the folder...
            – ru111
            2 days ago











          • 1) Port: you can choose the one you like most, as long as it's not already in use. 2) You probably don't want to run sshfs as root; you can run it as your user, just make sure to pick as mount point a directory you can write to (other users won't be able to access it). 3) That is how mounting works: on /mnt/volume/ you will have the remote, mounted, directory, and the local content of /mnt/volume will not be accessible. Choose a different mount point if this is a problem.
            – fra-san
            2 days ago

















          • Thanks - I think I can use 2222 actually. So because I want mount a specific folder accessed through server-main, I did sudo sshfs -p 2222 myname@localhost:/group/data /mnt/volume. It did something, but now I can't access the folder on my mac - /mnt/volume disappears and accessing through the command line it gives me "no such file or directory". Unmounting brings me back the folder...
            – ru111
            2 days ago











          • 1) Port: you can choose the one you like most, as long as it's not already in use. 2) You probably don't want to run sshfs as root; you can run it as your user, just make sure to pick as mount point a directory you can write to (other users won't be able to access it). 3) That is how mounting works: on /mnt/volume/ you will have the remote, mounted, directory, and the local content of /mnt/volume will not be accessible. Choose a different mount point if this is a problem.
            – fra-san
            2 days ago
















          Thanks - I think I can use 2222 actually. So because I want mount a specific folder accessed through server-main, I did sudo sshfs -p 2222 myname@localhost:/group/data /mnt/volume. It did something, but now I can't access the folder on my mac - /mnt/volume disappears and accessing through the command line it gives me "no such file or directory". Unmounting brings me back the folder...
          – ru111
          2 days ago





          Thanks - I think I can use 2222 actually. So because I want mount a specific folder accessed through server-main, I did sudo sshfs -p 2222 myname@localhost:/group/data /mnt/volume. It did something, but now I can't access the folder on my mac - /mnt/volume disappears and accessing through the command line it gives me "no such file or directory". Unmounting brings me back the folder...
          – ru111
          2 days ago













          1) Port: you can choose the one you like most, as long as it's not already in use. 2) You probably don't want to run sshfs as root; you can run it as your user, just make sure to pick as mount point a directory you can write to (other users won't be able to access it). 3) That is how mounting works: on /mnt/volume/ you will have the remote, mounted, directory, and the local content of /mnt/volume will not be accessible. Choose a different mount point if this is a problem.
          – fra-san
          2 days ago





          1) Port: you can choose the one you like most, as long as it's not already in use. 2) You probably don't want to run sshfs as root; you can run it as your user, just make sure to pick as mount point a directory you can write to (other users won't be able to access it). 3) That is how mounting works: on /mnt/volume/ you will have the remote, mounted, directory, and the local content of /mnt/volume will not be accessible. Choose a different mount point if this is a problem.
          – fra-san
          2 days ago


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f482147%2fsshfs-through-two-hops%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown






          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay