How to mount remote SSHFS via intermediate machine? Tunneling?Mount a filesystem (using FUSE) with SSH...

Advice for a new journal editor

Finding lengths when circles and squares tangents.

A starship is travelling at 0.9c and collides with a small rock. Will it leave a clean hole through, or will more happen?

Can we harness gravitational potential energy?

Is a new Boolean field better than a null reference when a value can be meaningfully absent?

How can I get my players to come to the game session after agreeing to a date?

What is the purpose of easy combat scenarios that don't need resource expenditure?

Story about a person invited to join council of intellects

Graph with overlapping labels

Why was Lupin comfortable with saying Voldemort's name?

If I delete my router's history can my ISP still provide it to my parents?

Cat is tipping over bed-side lamps during the night

Publishing research using outdated methods

How can animals be objects of ethics without being subjects as well?

Why exactly do action photographers need high fps burst cameras?

Eww, those bytes are gross

speculum - A simple, straightforward Arch Linux mirror list optimizer

IGBT transistor with auxiliary emitter

How should I handle players who ignore the session zero agreement?

How much mayhem could I cause as a sentient fish?

Why would space fleets be aligned?

Is boss over stepping boundary/micromanaging?

Why are the books in the Game of Thrones citadel library shelved spine inwards?

What is the most fuel efficient way out of the Solar System?



How to mount remote SSHFS via intermediate machine? Tunneling?


Mount a filesystem (using FUSE) with SSH through two computersAn SSH tunnel via multiple hopsWork blocks OpenSSH but not puttyHow to avoid sshfs freezing?Mount a filesystem (using FUSE) with SSH through two computersReverse sshfs tunnelMounting a remote disk image which I made local via sshfs? Possible?sshfs is failing with “remote host has disconnected”Linux graphical alternative to WinSCP tunneled connectionPlay sound *on* remote machine via ssh on Ubuntu / LinuxSynology - mount a directory via sshfs with user/group mappingReverse sshfs over sshHow can I avert ssh tunneling interference













24















I would like to mount a remote file system (A) using SSHFS, but sometimes I have IP address, access from which is not allowed. So my plan is to access it via another machine (B) in that network. Do I need to mount A on B and then to mount B (and A) on my local computer? Is there a better way to do it?



Update



Just to clarify the procedure:



First, I make a tunnel



ssh -f user@machineB -L MYPORT:machineA:22 -N


And then I mount the remote file system



sshfs -p MYPORT user@127.0.0.1:/myremotepath /mylocalpath


Is it correct?



How do I destroy the tunnel when I am done?










share|improve this question




















  • 1





    better way to set up tunnel is to have connection to B from GNU screen window using ssh user@machineB -L 2222:machineA:22 -N so you can easily kill it with ^C

    – edk
    May 9 '10 at 16:03
















24















I would like to mount a remote file system (A) using SSHFS, but sometimes I have IP address, access from which is not allowed. So my plan is to access it via another machine (B) in that network. Do I need to mount A on B and then to mount B (and A) on my local computer? Is there a better way to do it?



Update



Just to clarify the procedure:



First, I make a tunnel



ssh -f user@machineB -L MYPORT:machineA:22 -N


And then I mount the remote file system



sshfs -p MYPORT user@127.0.0.1:/myremotepath /mylocalpath


Is it correct?



How do I destroy the tunnel when I am done?










share|improve this question




















  • 1





    better way to set up tunnel is to have connection to B from GNU screen window using ssh user@machineB -L 2222:machineA:22 -N so you can easily kill it with ^C

    – edk
    May 9 '10 at 16:03














24












24








24


14






I would like to mount a remote file system (A) using SSHFS, but sometimes I have IP address, access from which is not allowed. So my plan is to access it via another machine (B) in that network. Do I need to mount A on B and then to mount B (and A) on my local computer? Is there a better way to do it?



Update



Just to clarify the procedure:



First, I make a tunnel



ssh -f user@machineB -L MYPORT:machineA:22 -N


And then I mount the remote file system



sshfs -p MYPORT user@127.0.0.1:/myremotepath /mylocalpath


Is it correct?



How do I destroy the tunnel when I am done?










share|improve this question
















I would like to mount a remote file system (A) using SSHFS, but sometimes I have IP address, access from which is not allowed. So my plan is to access it via another machine (B) in that network. Do I need to mount A on B and then to mount B (and A) on my local computer? Is there a better way to do it?



Update



Just to clarify the procedure:



First, I make a tunnel



ssh -f user@machineB -L MYPORT:machineA:22 -N


And then I mount the remote file system



sshfs -p MYPORT user@127.0.0.1:/myremotepath /mylocalpath


Is it correct?



How do I destroy the tunnel when I am done?







ssh mount remote tunnel sshfs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 9 '10 at 10:05







Andrei

















asked May 8 '10 at 10:47









AndreiAndrei

61931027




61931027








  • 1





    better way to set up tunnel is to have connection to B from GNU screen window using ssh user@machineB -L 2222:machineA:22 -N so you can easily kill it with ^C

    – edk
    May 9 '10 at 16:03














  • 1





    better way to set up tunnel is to have connection to B from GNU screen window using ssh user@machineB -L 2222:machineA:22 -N so you can easily kill it with ^C

    – edk
    May 9 '10 at 16:03








1




1





better way to set up tunnel is to have connection to B from GNU screen window using ssh user@machineB -L 2222:machineA:22 -N so you can easily kill it with ^C

– edk
May 9 '10 at 16:03





better way to set up tunnel is to have connection to B from GNU screen window using ssh user@machineB -L 2222:machineA:22 -N so you can easily kill it with ^C

– edk
May 9 '10 at 16:03










3 Answers
3






active

oldest

votes


















9














yeah tunneling. You connect machine B, create local tunnel (-L) to SSHd port of machine A then sshfs to localhost to the port of newly created tunnel.






share|improve this answer
























  • Is the following command the right way to do that? ssh -f user@machineB -L 25:machineA:25 -N

    – Andrei
    May 8 '10 at 14:00






  • 1





    yes if you have sshd listening to port 25 on machine A. then you'll just have to sshfs -p 25 user@127.0.0.1:/path /localpath

    – edk
    May 8 '10 at 14:20








  • 1





    Aha, so for default ssh setup I need ssh -f user@machineB -L 22:machineA:22 -N, right?

    – Andrei
    May 8 '10 at 15:32



















13














You can use option ssh_command of sshfs to do the trick:



sshfs ma: /mnt -o ssh_command='ssh -t mb ssh'


Unmount with the usual



fusermount -u /mnt


Sorry this is 7 years late...






share|improve this answer



















  • 3





    With the new -J option in Openssh 1.1 it is something along: sshfs ma: /mnt -o ssh_command='ssh -J mb'

    – Ohad Rubin
    Jul 18 '18 at 1:25



















0














Your connection scheme:
Your machine --> Host B --> Host A



Our solution will use Proxy Jump, introduced in OpenSSH 7.3, so you'll need to check that your version is newer with:



ssh -V


Then you need to configure properly your ~/.ssh/config. For example, if machineB is available with a password login from machineA :



machineB
HostName {machineB ip address}
User {machineB username}
Port {machineB port-number}
IdentityFile ~/.ssh/{machineB private ssh key}

machineA
ProxyJump machineB
Hostname {machineA ip address, maybe in local network}
User {machineA username}
Port {machineA port-number}


Finally, create your mountpoint and add line to /etc/fstab



machineB:{machineB mount path}  {your local mountpoint}  fuse.sshfs delay_connect,_netdev,user,idmap=user,transform_symlinks,identityfile={local path to machineB private key},default_permissions,uid={local user uid},gid={local user gid} 0 0




share























    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%2f139023%2fhow-to-mount-remote-sshfs-via-intermediate-machine-tunneling%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    9














    yeah tunneling. You connect machine B, create local tunnel (-L) to SSHd port of machine A then sshfs to localhost to the port of newly created tunnel.






    share|improve this answer
























    • Is the following command the right way to do that? ssh -f user@machineB -L 25:machineA:25 -N

      – Andrei
      May 8 '10 at 14:00






    • 1





      yes if you have sshd listening to port 25 on machine A. then you'll just have to sshfs -p 25 user@127.0.0.1:/path /localpath

      – edk
      May 8 '10 at 14:20








    • 1





      Aha, so for default ssh setup I need ssh -f user@machineB -L 22:machineA:22 -N, right?

      – Andrei
      May 8 '10 at 15:32
















    9














    yeah tunneling. You connect machine B, create local tunnel (-L) to SSHd port of machine A then sshfs to localhost to the port of newly created tunnel.






    share|improve this answer
























    • Is the following command the right way to do that? ssh -f user@machineB -L 25:machineA:25 -N

      – Andrei
      May 8 '10 at 14:00






    • 1





      yes if you have sshd listening to port 25 on machine A. then you'll just have to sshfs -p 25 user@127.0.0.1:/path /localpath

      – edk
      May 8 '10 at 14:20








    • 1





      Aha, so for default ssh setup I need ssh -f user@machineB -L 22:machineA:22 -N, right?

      – Andrei
      May 8 '10 at 15:32














    9












    9








    9







    yeah tunneling. You connect machine B, create local tunnel (-L) to SSHd port of machine A then sshfs to localhost to the port of newly created tunnel.






    share|improve this answer













    yeah tunneling. You connect machine B, create local tunnel (-L) to SSHd port of machine A then sshfs to localhost to the port of newly created tunnel.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered May 8 '10 at 12:43









    edkedk

    1883




    1883













    • Is the following command the right way to do that? ssh -f user@machineB -L 25:machineA:25 -N

      – Andrei
      May 8 '10 at 14:00






    • 1





      yes if you have sshd listening to port 25 on machine A. then you'll just have to sshfs -p 25 user@127.0.0.1:/path /localpath

      – edk
      May 8 '10 at 14:20








    • 1





      Aha, so for default ssh setup I need ssh -f user@machineB -L 22:machineA:22 -N, right?

      – Andrei
      May 8 '10 at 15:32



















    • Is the following command the right way to do that? ssh -f user@machineB -L 25:machineA:25 -N

      – Andrei
      May 8 '10 at 14:00






    • 1





      yes if you have sshd listening to port 25 on machine A. then you'll just have to sshfs -p 25 user@127.0.0.1:/path /localpath

      – edk
      May 8 '10 at 14:20








    • 1





      Aha, so for default ssh setup I need ssh -f user@machineB -L 22:machineA:22 -N, right?

      – Andrei
      May 8 '10 at 15:32

















    Is the following command the right way to do that? ssh -f user@machineB -L 25:machineA:25 -N

    – Andrei
    May 8 '10 at 14:00





    Is the following command the right way to do that? ssh -f user@machineB -L 25:machineA:25 -N

    – Andrei
    May 8 '10 at 14:00




    1




    1





    yes if you have sshd listening to port 25 on machine A. then you'll just have to sshfs -p 25 user@127.0.0.1:/path /localpath

    – edk
    May 8 '10 at 14:20







    yes if you have sshd listening to port 25 on machine A. then you'll just have to sshfs -p 25 user@127.0.0.1:/path /localpath

    – edk
    May 8 '10 at 14:20






    1




    1





    Aha, so for default ssh setup I need ssh -f user@machineB -L 22:machineA:22 -N, right?

    – Andrei
    May 8 '10 at 15:32





    Aha, so for default ssh setup I need ssh -f user@machineB -L 22:machineA:22 -N, right?

    – Andrei
    May 8 '10 at 15:32













    13














    You can use option ssh_command of sshfs to do the trick:



    sshfs ma: /mnt -o ssh_command='ssh -t mb ssh'


    Unmount with the usual



    fusermount -u /mnt


    Sorry this is 7 years late...






    share|improve this answer



















    • 3





      With the new -J option in Openssh 1.1 it is something along: sshfs ma: /mnt -o ssh_command='ssh -J mb'

      – Ohad Rubin
      Jul 18 '18 at 1:25
















    13














    You can use option ssh_command of sshfs to do the trick:



    sshfs ma: /mnt -o ssh_command='ssh -t mb ssh'


    Unmount with the usual



    fusermount -u /mnt


    Sorry this is 7 years late...






    share|improve this answer



















    • 3





      With the new -J option in Openssh 1.1 it is something along: sshfs ma: /mnt -o ssh_command='ssh -J mb'

      – Ohad Rubin
      Jul 18 '18 at 1:25














    13












    13








    13







    You can use option ssh_command of sshfs to do the trick:



    sshfs ma: /mnt -o ssh_command='ssh -t mb ssh'


    Unmount with the usual



    fusermount -u /mnt


    Sorry this is 7 years late...






    share|improve this answer













    You can use option ssh_command of sshfs to do the trick:



    sshfs ma: /mnt -o ssh_command='ssh -t mb ssh'


    Unmount with the usual



    fusermount -u /mnt


    Sorry this is 7 years late...







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Oct 8 '17 at 0:34









    Rodrigo FariasRodrigo Farias

    13112




    13112








    • 3





      With the new -J option in Openssh 1.1 it is something along: sshfs ma: /mnt -o ssh_command='ssh -J mb'

      – Ohad Rubin
      Jul 18 '18 at 1:25














    • 3





      With the new -J option in Openssh 1.1 it is something along: sshfs ma: /mnt -o ssh_command='ssh -J mb'

      – Ohad Rubin
      Jul 18 '18 at 1:25








    3




    3





    With the new -J option in Openssh 1.1 it is something along: sshfs ma: /mnt -o ssh_command='ssh -J mb'

    – Ohad Rubin
    Jul 18 '18 at 1:25





    With the new -J option in Openssh 1.1 it is something along: sshfs ma: /mnt -o ssh_command='ssh -J mb'

    – Ohad Rubin
    Jul 18 '18 at 1:25











    0














    Your connection scheme:
    Your machine --> Host B --> Host A



    Our solution will use Proxy Jump, introduced in OpenSSH 7.3, so you'll need to check that your version is newer with:



    ssh -V


    Then you need to configure properly your ~/.ssh/config. For example, if machineB is available with a password login from machineA :



    machineB
    HostName {machineB ip address}
    User {machineB username}
    Port {machineB port-number}
    IdentityFile ~/.ssh/{machineB private ssh key}

    machineA
    ProxyJump machineB
    Hostname {machineA ip address, maybe in local network}
    User {machineA username}
    Port {machineA port-number}


    Finally, create your mountpoint and add line to /etc/fstab



    machineB:{machineB mount path}  {your local mountpoint}  fuse.sshfs delay_connect,_netdev,user,idmap=user,transform_symlinks,identityfile={local path to machineB private key},default_permissions,uid={local user uid},gid={local user gid} 0 0




    share




























      0














      Your connection scheme:
      Your machine --> Host B --> Host A



      Our solution will use Proxy Jump, introduced in OpenSSH 7.3, so you'll need to check that your version is newer with:



      ssh -V


      Then you need to configure properly your ~/.ssh/config. For example, if machineB is available with a password login from machineA :



      machineB
      HostName {machineB ip address}
      User {machineB username}
      Port {machineB port-number}
      IdentityFile ~/.ssh/{machineB private ssh key}

      machineA
      ProxyJump machineB
      Hostname {machineA ip address, maybe in local network}
      User {machineA username}
      Port {machineA port-number}


      Finally, create your mountpoint and add line to /etc/fstab



      machineB:{machineB mount path}  {your local mountpoint}  fuse.sshfs delay_connect,_netdev,user,idmap=user,transform_symlinks,identityfile={local path to machineB private key},default_permissions,uid={local user uid},gid={local user gid} 0 0




      share


























        0












        0








        0







        Your connection scheme:
        Your machine --> Host B --> Host A



        Our solution will use Proxy Jump, introduced in OpenSSH 7.3, so you'll need to check that your version is newer with:



        ssh -V


        Then you need to configure properly your ~/.ssh/config. For example, if machineB is available with a password login from machineA :



        machineB
        HostName {machineB ip address}
        User {machineB username}
        Port {machineB port-number}
        IdentityFile ~/.ssh/{machineB private ssh key}

        machineA
        ProxyJump machineB
        Hostname {machineA ip address, maybe in local network}
        User {machineA username}
        Port {machineA port-number}


        Finally, create your mountpoint and add line to /etc/fstab



        machineB:{machineB mount path}  {your local mountpoint}  fuse.sshfs delay_connect,_netdev,user,idmap=user,transform_symlinks,identityfile={local path to machineB private key},default_permissions,uid={local user uid},gid={local user gid} 0 0




        share













        Your connection scheme:
        Your machine --> Host B --> Host A



        Our solution will use Proxy Jump, introduced in OpenSSH 7.3, so you'll need to check that your version is newer with:



        ssh -V


        Then you need to configure properly your ~/.ssh/config. For example, if machineB is available with a password login from machineA :



        machineB
        HostName {machineB ip address}
        User {machineB username}
        Port {machineB port-number}
        IdentityFile ~/.ssh/{machineB private ssh key}

        machineA
        ProxyJump machineB
        Hostname {machineA ip address, maybe in local network}
        User {machineA username}
        Port {machineA port-number}


        Finally, create your mountpoint and add line to /etc/fstab



        machineB:{machineB mount path}  {your local mountpoint}  fuse.sshfs delay_connect,_netdev,user,idmap=user,transform_symlinks,identityfile={local path to machineB private key},default_permissions,uid={local user uid},gid={local user gid} 0 0





        share











        share


        share










        answered 9 mins ago









        lucidyanlucidyan

        1011




        1011






























            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%2f139023%2fhow-to-mount-remote-sshfs-via-intermediate-machine-tunneling%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

            Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

            VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

            Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...