How to mount local directory to remote hosts?












0















I'm doing some experiments with some computers I have, I have the following scenario



local network
host1 [ubuntu]
vps [internet]
host2 [CentOS]


I have an external hard disk connected to the host1 and my goal is to be able to access those files from the host2(VPS)



I can reach the host2 from the host1 over ssh but not backwards



host1 ---ssh--> host2 //possible
host1 <--ssh--- host2 //not possible


what I have done so far:



I tried using sshfs with reverse tunneling but I just can't have it work, I have seen lot's of examples where the connection is done from host2 to host1 but in my case since I can't ssh to host1 the samples I see don't work and there is very little info about reverse tunneling with sshfs



also, I tried with mount-on but it didn't work



is this possible under these conditions? if so, what am I missing?
is there something easier?



thank you










share|improve this question























  • You say you can reach host1 from host2 but not reverse. You really need to fix this before trying to get NFS working. What about setting up a VPN from host 2 to host1, then connecting over that? It's more secure for NFS as well.

    – davidgo
    Apr 1 '18 at 5:03











  • yes, that is a problem, actually, right now I'm trying to set up a network tunnel between those hosts, I will give it a try and update :)

    – Frederick Álvarez
    Apr 1 '18 at 5:11
















0















I'm doing some experiments with some computers I have, I have the following scenario



local network
host1 [ubuntu]
vps [internet]
host2 [CentOS]


I have an external hard disk connected to the host1 and my goal is to be able to access those files from the host2(VPS)



I can reach the host2 from the host1 over ssh but not backwards



host1 ---ssh--> host2 //possible
host1 <--ssh--- host2 //not possible


what I have done so far:



I tried using sshfs with reverse tunneling but I just can't have it work, I have seen lot's of examples where the connection is done from host2 to host1 but in my case since I can't ssh to host1 the samples I see don't work and there is very little info about reverse tunneling with sshfs



also, I tried with mount-on but it didn't work



is this possible under these conditions? if so, what am I missing?
is there something easier?



thank you










share|improve this question























  • You say you can reach host1 from host2 but not reverse. You really need to fix this before trying to get NFS working. What about setting up a VPN from host 2 to host1, then connecting over that? It's more secure for NFS as well.

    – davidgo
    Apr 1 '18 at 5:03











  • yes, that is a problem, actually, right now I'm trying to set up a network tunnel between those hosts, I will give it a try and update :)

    – Frederick Álvarez
    Apr 1 '18 at 5:11














0












0








0








I'm doing some experiments with some computers I have, I have the following scenario



local network
host1 [ubuntu]
vps [internet]
host2 [CentOS]


I have an external hard disk connected to the host1 and my goal is to be able to access those files from the host2(VPS)



I can reach the host2 from the host1 over ssh but not backwards



host1 ---ssh--> host2 //possible
host1 <--ssh--- host2 //not possible


what I have done so far:



I tried using sshfs with reverse tunneling but I just can't have it work, I have seen lot's of examples where the connection is done from host2 to host1 but in my case since I can't ssh to host1 the samples I see don't work and there is very little info about reverse tunneling with sshfs



also, I tried with mount-on but it didn't work



is this possible under these conditions? if so, what am I missing?
is there something easier?



thank you










share|improve this question














I'm doing some experiments with some computers I have, I have the following scenario



local network
host1 [ubuntu]
vps [internet]
host2 [CentOS]


I have an external hard disk connected to the host1 and my goal is to be able to access those files from the host2(VPS)



I can reach the host2 from the host1 over ssh but not backwards



host1 ---ssh--> host2 //possible
host1 <--ssh--- host2 //not possible


what I have done so far:



I tried using sshfs with reverse tunneling but I just can't have it work, I have seen lot's of examples where the connection is done from host2 to host1 but in my case since I can't ssh to host1 the samples I see don't work and there is very little info about reverse tunneling with sshfs



also, I tried with mount-on but it didn't work



is this possible under these conditions? if so, what am I missing?
is there something easier?



thank you







networking nfs centos-7 sshfs






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 1 '18 at 4:39









Frederick ÁlvarezFrederick Álvarez

12




12













  • You say you can reach host1 from host2 but not reverse. You really need to fix this before trying to get NFS working. What about setting up a VPN from host 2 to host1, then connecting over that? It's more secure for NFS as well.

    – davidgo
    Apr 1 '18 at 5:03











  • yes, that is a problem, actually, right now I'm trying to set up a network tunnel between those hosts, I will give it a try and update :)

    – Frederick Álvarez
    Apr 1 '18 at 5:11



















  • You say you can reach host1 from host2 but not reverse. You really need to fix this before trying to get NFS working. What about setting up a VPN from host 2 to host1, then connecting over that? It's more secure for NFS as well.

    – davidgo
    Apr 1 '18 at 5:03











  • yes, that is a problem, actually, right now I'm trying to set up a network tunnel between those hosts, I will give it a try and update :)

    – Frederick Álvarez
    Apr 1 '18 at 5:11

















You say you can reach host1 from host2 but not reverse. You really need to fix this before trying to get NFS working. What about setting up a VPN from host 2 to host1, then connecting over that? It's more secure for NFS as well.

– davidgo
Apr 1 '18 at 5:03





You say you can reach host1 from host2 but not reverse. You really need to fix this before trying to get NFS working. What about setting up a VPN from host 2 to host1, then connecting over that? It's more secure for NFS as well.

– davidgo
Apr 1 '18 at 5:03













yes, that is a problem, actually, right now I'm trying to set up a network tunnel between those hosts, I will give it a try and update :)

– Frederick Álvarez
Apr 1 '18 at 5:11





yes, that is a problem, actually, right now I'm trying to set up a network tunnel between those hosts, I will give it a try and update :)

– Frederick Álvarez
Apr 1 '18 at 5:11










2 Answers
2






active

oldest

votes


















1














is late but... maybe other can use this.



If you want to connect the remote server to your local computer, make a tunnel with ssh.



$ ssh -NR 6969:localhost:22 my-ssh-key



Then you have a connection on the remote server in port 6969 to your local machine. Now just type this code to connect your local directory to the remote server.



$ sshfs -p 6969 YOUR_USER@localhost:/LOCAL_DIRECTORY/ /YOUR_REMOTE_MOUNT_POINT/






share|improve this answer































    0














    after struggling, for a couple of hours, I found out that there is no way to solve the issue without having bidirectional communication, so, what I did was to set up a VPN to have communication from the host2 to host1.



    The full detailed procedure that I followed is available here hope it helps you if you are trying to accomplish something similar






    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      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',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      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%2fsuperuser.com%2fquestions%2f1309740%2fhow-to-mount-local-directory-to-remote-hosts%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      is late but... maybe other can use this.



      If you want to connect the remote server to your local computer, make a tunnel with ssh.



      $ ssh -NR 6969:localhost:22 my-ssh-key



      Then you have a connection on the remote server in port 6969 to your local machine. Now just type this code to connect your local directory to the remote server.



      $ sshfs -p 6969 YOUR_USER@localhost:/LOCAL_DIRECTORY/ /YOUR_REMOTE_MOUNT_POINT/






      share|improve this answer




























        1














        is late but... maybe other can use this.



        If you want to connect the remote server to your local computer, make a tunnel with ssh.



        $ ssh -NR 6969:localhost:22 my-ssh-key



        Then you have a connection on the remote server in port 6969 to your local machine. Now just type this code to connect your local directory to the remote server.



        $ sshfs -p 6969 YOUR_USER@localhost:/LOCAL_DIRECTORY/ /YOUR_REMOTE_MOUNT_POINT/






        share|improve this answer


























          1












          1








          1







          is late but... maybe other can use this.



          If you want to connect the remote server to your local computer, make a tunnel with ssh.



          $ ssh -NR 6969:localhost:22 my-ssh-key



          Then you have a connection on the remote server in port 6969 to your local machine. Now just type this code to connect your local directory to the remote server.



          $ sshfs -p 6969 YOUR_USER@localhost:/LOCAL_DIRECTORY/ /YOUR_REMOTE_MOUNT_POINT/






          share|improve this answer













          is late but... maybe other can use this.



          If you want to connect the remote server to your local computer, make a tunnel with ssh.



          $ ssh -NR 6969:localhost:22 my-ssh-key



          Then you have a connection on the remote server in port 6969 to your local machine. Now just type this code to connect your local directory to the remote server.



          $ sshfs -p 6969 YOUR_USER@localhost:/LOCAL_DIRECTORY/ /YOUR_REMOTE_MOUNT_POINT/







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 11 at 22:04









          Anthony MilanAnthony Milan

          111




          111

























              0














              after struggling, for a couple of hours, I found out that there is no way to solve the issue without having bidirectional communication, so, what I did was to set up a VPN to have communication from the host2 to host1.



              The full detailed procedure that I followed is available here hope it helps you if you are trying to accomplish something similar






              share|improve this answer




























                0














                after struggling, for a couple of hours, I found out that there is no way to solve the issue without having bidirectional communication, so, what I did was to set up a VPN to have communication from the host2 to host1.



                The full detailed procedure that I followed is available here hope it helps you if you are trying to accomplish something similar






                share|improve this answer


























                  0












                  0








                  0







                  after struggling, for a couple of hours, I found out that there is no way to solve the issue without having bidirectional communication, so, what I did was to set up a VPN to have communication from the host2 to host1.



                  The full detailed procedure that I followed is available here hope it helps you if you are trying to accomplish something similar






                  share|improve this answer













                  after struggling, for a couple of hours, I found out that there is no way to solve the issue without having bidirectional communication, so, what I did was to set up a VPN to have communication from the host2 to host1.



                  The full detailed procedure that I followed is available here hope it helps you if you are trying to accomplish something similar







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 5 '18 at 18:15









                  Frederick ÁlvarezFrederick Álvarez

                  12




                  12






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1309740%2fhow-to-mount-local-directory-to-remote-hosts%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

                      flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                      Mangá

                      Eduardo VII do Reino Unido