Is there a way to use sshfs for a machine “two jumps away”?












1















For transferring files between two Linux machines I always felt more comfortable using the graphical file managers such as Nautilus, which offer the option to connect to a remote machine via SSH. However today I need to transfer files to a machine I cannot access directly -- I need to first SSH into a certain server and then do another SSH into my final destination. Is there still a way to do a GUI-friendly file transfer here or should I just fall back to good-old command-line scp this time?










share|improve this question























  • Does the intermediate server allow tunnels?

    – A.B
    Jan 21 at 20:14











  • I have no idea, but feel free to answer assuming they do :)

    – hugomg
    Jan 21 at 20:15
















1















For transferring files between two Linux machines I always felt more comfortable using the graphical file managers such as Nautilus, which offer the option to connect to a remote machine via SSH. However today I need to transfer files to a machine I cannot access directly -- I need to first SSH into a certain server and then do another SSH into my final destination. Is there still a way to do a GUI-friendly file transfer here or should I just fall back to good-old command-line scp this time?










share|improve this question























  • Does the intermediate server allow tunnels?

    – A.B
    Jan 21 at 20:14











  • I have no idea, but feel free to answer assuming they do :)

    – hugomg
    Jan 21 at 20:15














1












1








1








For transferring files between two Linux machines I always felt more comfortable using the graphical file managers such as Nautilus, which offer the option to connect to a remote machine via SSH. However today I need to transfer files to a machine I cannot access directly -- I need to first SSH into a certain server and then do another SSH into my final destination. Is there still a way to do a GUI-friendly file transfer here or should I just fall back to good-old command-line scp this time?










share|improve this question














For transferring files between two Linux machines I always felt more comfortable using the graphical file managers such as Nautilus, which offer the option to connect to a remote machine via SSH. However today I need to transfer files to a machine I cannot access directly -- I need to first SSH into a certain server and then do another SSH into my final destination. Is there still a way to do a GUI-friendly file transfer here or should I just fall back to good-old command-line scp this time?







ssh sshfs






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 21 at 19:50









hugomghugomg

1,86931635




1,86931635













  • Does the intermediate server allow tunnels?

    – A.B
    Jan 21 at 20:14











  • I have no idea, but feel free to answer assuming they do :)

    – hugomg
    Jan 21 at 20:15



















  • Does the intermediate server allow tunnels?

    – A.B
    Jan 21 at 20:14











  • I have no idea, but feel free to answer assuming they do :)

    – hugomg
    Jan 21 at 20:15

















Does the intermediate server allow tunnels?

– A.B
Jan 21 at 20:14





Does the intermediate server allow tunnels?

– A.B
Jan 21 at 20:14













I have no idea, but feel free to answer assuming they do :)

– hugomg
Jan 21 at 20:15





I have no idea, but feel free to answer assuming they do :)

– hugomg
Jan 21 at 20:15










1 Answer
1






active

oldest

votes


















2














Supposing the intermediate host is allowing tunnels, you can do half of the work using command line and finish graphically as usual.



sshfs -o ssh_command='ssh -J firstuser@firsthost' finaluser@finalhost:directory localdirectory


This will instruct sshfs to run its ssh backend (itself running the sftp subsystem in the end) with an additional -J option, equivalent to the ProxyJump configuration option, which itself will transparently create a tunnel to the SSH destination.



This is equivalent to adding instead in $HOME/.ssh/config:



Host finalhost
ProxyJump firstuser@firsthost


and just run sshfs finaluser@finalhost:directory localdirectory, or else you can also put the above two lines in a file and use the -F option of sshfs with this file.



Now your directory localdirectory is usable with Nautilus or any other tool, GUI or not (but usually limited to the user running sshfs, as usual).



It's quite possible that having this option in $HOME/.ssh/config will allow your GUI tool to transparently work as usual to mount the directory, thus not needing CLI anymore. I couldn't test this.






share|improve this answer

























    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',
    autoActivateHeartbeat: false,
    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%2f495845%2fis-there-a-way-to-use-sshfs-for-a-machine-two-jumps-away%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









    2














    Supposing the intermediate host is allowing tunnels, you can do half of the work using command line and finish graphically as usual.



    sshfs -o ssh_command='ssh -J firstuser@firsthost' finaluser@finalhost:directory localdirectory


    This will instruct sshfs to run its ssh backend (itself running the sftp subsystem in the end) with an additional -J option, equivalent to the ProxyJump configuration option, which itself will transparently create a tunnel to the SSH destination.



    This is equivalent to adding instead in $HOME/.ssh/config:



    Host finalhost
    ProxyJump firstuser@firsthost


    and just run sshfs finaluser@finalhost:directory localdirectory, or else you can also put the above two lines in a file and use the -F option of sshfs with this file.



    Now your directory localdirectory is usable with Nautilus or any other tool, GUI or not (but usually limited to the user running sshfs, as usual).



    It's quite possible that having this option in $HOME/.ssh/config will allow your GUI tool to transparently work as usual to mount the directory, thus not needing CLI anymore. I couldn't test this.






    share|improve this answer






























      2














      Supposing the intermediate host is allowing tunnels, you can do half of the work using command line and finish graphically as usual.



      sshfs -o ssh_command='ssh -J firstuser@firsthost' finaluser@finalhost:directory localdirectory


      This will instruct sshfs to run its ssh backend (itself running the sftp subsystem in the end) with an additional -J option, equivalent to the ProxyJump configuration option, which itself will transparently create a tunnel to the SSH destination.



      This is equivalent to adding instead in $HOME/.ssh/config:



      Host finalhost
      ProxyJump firstuser@firsthost


      and just run sshfs finaluser@finalhost:directory localdirectory, or else you can also put the above two lines in a file and use the -F option of sshfs with this file.



      Now your directory localdirectory is usable with Nautilus or any other tool, GUI or not (but usually limited to the user running sshfs, as usual).



      It's quite possible that having this option in $HOME/.ssh/config will allow your GUI tool to transparently work as usual to mount the directory, thus not needing CLI anymore. I couldn't test this.






      share|improve this answer




























        2












        2








        2







        Supposing the intermediate host is allowing tunnels, you can do half of the work using command line and finish graphically as usual.



        sshfs -o ssh_command='ssh -J firstuser@firsthost' finaluser@finalhost:directory localdirectory


        This will instruct sshfs to run its ssh backend (itself running the sftp subsystem in the end) with an additional -J option, equivalent to the ProxyJump configuration option, which itself will transparently create a tunnel to the SSH destination.



        This is equivalent to adding instead in $HOME/.ssh/config:



        Host finalhost
        ProxyJump firstuser@firsthost


        and just run sshfs finaluser@finalhost:directory localdirectory, or else you can also put the above two lines in a file and use the -F option of sshfs with this file.



        Now your directory localdirectory is usable with Nautilus or any other tool, GUI or not (but usually limited to the user running sshfs, as usual).



        It's quite possible that having this option in $HOME/.ssh/config will allow your GUI tool to transparently work as usual to mount the directory, thus not needing CLI anymore. I couldn't test this.






        share|improve this answer















        Supposing the intermediate host is allowing tunnels, you can do half of the work using command line and finish graphically as usual.



        sshfs -o ssh_command='ssh -J firstuser@firsthost' finaluser@finalhost:directory localdirectory


        This will instruct sshfs to run its ssh backend (itself running the sftp subsystem in the end) with an additional -J option, equivalent to the ProxyJump configuration option, which itself will transparently create a tunnel to the SSH destination.



        This is equivalent to adding instead in $HOME/.ssh/config:



        Host finalhost
        ProxyJump firstuser@firsthost


        and just run sshfs finaluser@finalhost:directory localdirectory, or else you can also put the above two lines in a file and use the -F option of sshfs with this file.



        Now your directory localdirectory is usable with Nautilus or any other tool, GUI or not (but usually limited to the user running sshfs, as usual).



        It's quite possible that having this option in $HOME/.ssh/config will allow your GUI tool to transparently work as usual to mount the directory, thus not needing CLI anymore. I couldn't test this.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 21 at 20:40

























        answered Jan 21 at 20:34









        A.BA.B

        4,5471725




        4,5471725






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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%2funix.stackexchange.com%2fquestions%2f495845%2fis-there-a-way-to-use-sshfs-for-a-machine-two-jumps-away%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 make a Squid Proxy server?

            Is this a new Fibonacci Identity?

            19世紀