Access Windows Share from local linux machine through remote ssh server












1















I work from my Ubuntu laptop. I need to access a Windows share that is accessible only from within my university's LAN. But, I can ssh to a remote server which is right there in univ's LAN. I believe there must be a way to hop from my laptop to the remote server to the Windows share, but apparently I can't make it work.



I tried to ssh the remote machine, and access the windows share with smbclient



smbclient //the.windows.share/my_group_share -U username


with NO success (got a NT_STATUS_BAD_NETWORK_NAME error ). I've searched and read on the web and found some solutions using VPN over SSH tunneling, but I'm not sure it fits for my needs. besides, a first attempt did not work, couldn't even connect.



can somebody point me to a solution?










share|improve this question





























    1















    I work from my Ubuntu laptop. I need to access a Windows share that is accessible only from within my university's LAN. But, I can ssh to a remote server which is right there in univ's LAN. I believe there must be a way to hop from my laptop to the remote server to the Windows share, but apparently I can't make it work.



    I tried to ssh the remote machine, and access the windows share with smbclient



    smbclient //the.windows.share/my_group_share -U username


    with NO success (got a NT_STATUS_BAD_NETWORK_NAME error ). I've searched and read on the web and found some solutions using VPN over SSH tunneling, but I'm not sure it fits for my needs. besides, a first attempt did not work, couldn't even connect.



    can somebody point me to a solution?










    share|improve this question



























      1












      1








      1








      I work from my Ubuntu laptop. I need to access a Windows share that is accessible only from within my university's LAN. But, I can ssh to a remote server which is right there in univ's LAN. I believe there must be a way to hop from my laptop to the remote server to the Windows share, but apparently I can't make it work.



      I tried to ssh the remote machine, and access the windows share with smbclient



      smbclient //the.windows.share/my_group_share -U username


      with NO success (got a NT_STATUS_BAD_NETWORK_NAME error ). I've searched and read on the web and found some solutions using VPN over SSH tunneling, but I'm not sure it fits for my needs. besides, a first attempt did not work, couldn't even connect.



      can somebody point me to a solution?










      share|improve this question
















      I work from my Ubuntu laptop. I need to access a Windows share that is accessible only from within my university's LAN. But, I can ssh to a remote server which is right there in univ's LAN. I believe there must be a way to hop from my laptop to the remote server to the Windows share, but apparently I can't make it work.



      I tried to ssh the remote machine, and access the windows share with smbclient



      smbclient //the.windows.share/my_group_share -U username


      with NO success (got a NT_STATUS_BAD_NETWORK_NAME error ). I've searched and read on the web and found some solutions using VPN over SSH tunneling, but I'm not sure it fits for my needs. besides, a first attempt did not work, couldn't even connect.



      can somebody point me to a solution?







      ssh samba remote file-sharing






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 11 mins ago









      Rui F Ribeiro

      40.1k1479135




      40.1k1479135










      asked Dec 23 '13 at 20:46









      FaabiiooFaabiioo

      113




      113






















          2 Answers
          2






          active

          oldest

          votes


















          1














          You can probably tunnel the SMB connection through SSH. In your .ssh/config:



          Host your_remote_host
          LocalForward localhost:139 the.windows.share:139


          Then, ssh your_remote_host sleep 10 & smbclient //localhost/your_group_share -U username might work






          share|improve this answer
























          • so I configured ssh and used this command sudo ssh -F ~/.ssh/config remote_host sleep 10 & smbclient //localhost/my_group_share -U username, because without sudo it says those privileged ports can't be forwarded, but the remote_host is host-configured. but I keep getting that error message about the network name. As I said, it is correct, because I copied it from the fstab, where I set the share to automount, when I am in my office at the univ.

            – Faabiioo
            Dec 24 '13 at 10:11



















          0














          First of all, you need to get the samba connection to work. NT_STATUS_BAD_NETWORK_NAME means the client wasn't able to find the share - check the typing (case, typos, etc.). It might be also connected to access rights on the server, so veryfying that it works from windows should be the first step.



          After that there are several ways to make it work. One involves tunnelling Samba through SSH: forwarding appropriate ports with ssh and then using Samba to connect to a port on your local machine (which is forwarded to the remote on-campus system). Alternatively, if you can mount the Windows share on the campus server and export it via SSHFS.






          share|improve this answer
























          • the connection error looked weird to me, as the path was copy/pasted. it is correct an normally works. I'm gonna try with the tunnelling

            – Faabiioo
            Dec 24 '13 at 9:12











          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%2f106407%2faccess-windows-share-from-local-linux-machine-through-remote-ssh-server%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














          You can probably tunnel the SMB connection through SSH. In your .ssh/config:



          Host your_remote_host
          LocalForward localhost:139 the.windows.share:139


          Then, ssh your_remote_host sleep 10 & smbclient //localhost/your_group_share -U username might work






          share|improve this answer
























          • so I configured ssh and used this command sudo ssh -F ~/.ssh/config remote_host sleep 10 & smbclient //localhost/my_group_share -U username, because without sudo it says those privileged ports can't be forwarded, but the remote_host is host-configured. but I keep getting that error message about the network name. As I said, it is correct, because I copied it from the fstab, where I set the share to automount, when I am in my office at the univ.

            – Faabiioo
            Dec 24 '13 at 10:11
















          1














          You can probably tunnel the SMB connection through SSH. In your .ssh/config:



          Host your_remote_host
          LocalForward localhost:139 the.windows.share:139


          Then, ssh your_remote_host sleep 10 & smbclient //localhost/your_group_share -U username might work






          share|improve this answer
























          • so I configured ssh and used this command sudo ssh -F ~/.ssh/config remote_host sleep 10 & smbclient //localhost/my_group_share -U username, because without sudo it says those privileged ports can't be forwarded, but the remote_host is host-configured. but I keep getting that error message about the network name. As I said, it is correct, because I copied it from the fstab, where I set the share to automount, when I am in my office at the univ.

            – Faabiioo
            Dec 24 '13 at 10:11














          1












          1








          1







          You can probably tunnel the SMB connection through SSH. In your .ssh/config:



          Host your_remote_host
          LocalForward localhost:139 the.windows.share:139


          Then, ssh your_remote_host sleep 10 & smbclient //localhost/your_group_share -U username might work






          share|improve this answer













          You can probably tunnel the SMB connection through SSH. In your .ssh/config:



          Host your_remote_host
          LocalForward localhost:139 the.windows.share:139


          Then, ssh your_remote_host sleep 10 & smbclient //localhost/your_group_share -U username might work







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 23 '13 at 21:35









          DopeGhotiDopeGhoti

          45.5k55988




          45.5k55988













          • so I configured ssh and used this command sudo ssh -F ~/.ssh/config remote_host sleep 10 & smbclient //localhost/my_group_share -U username, because without sudo it says those privileged ports can't be forwarded, but the remote_host is host-configured. but I keep getting that error message about the network name. As I said, it is correct, because I copied it from the fstab, where I set the share to automount, when I am in my office at the univ.

            – Faabiioo
            Dec 24 '13 at 10:11



















          • so I configured ssh and used this command sudo ssh -F ~/.ssh/config remote_host sleep 10 & smbclient //localhost/my_group_share -U username, because without sudo it says those privileged ports can't be forwarded, but the remote_host is host-configured. but I keep getting that error message about the network name. As I said, it is correct, because I copied it from the fstab, where I set the share to automount, when I am in my office at the univ.

            – Faabiioo
            Dec 24 '13 at 10:11

















          so I configured ssh and used this command sudo ssh -F ~/.ssh/config remote_host sleep 10 & smbclient //localhost/my_group_share -U username, because without sudo it says those privileged ports can't be forwarded, but the remote_host is host-configured. but I keep getting that error message about the network name. As I said, it is correct, because I copied it from the fstab, where I set the share to automount, when I am in my office at the univ.

          – Faabiioo
          Dec 24 '13 at 10:11





          so I configured ssh and used this command sudo ssh -F ~/.ssh/config remote_host sleep 10 & smbclient //localhost/my_group_share -U username, because without sudo it says those privileged ports can't be forwarded, but the remote_host is host-configured. but I keep getting that error message about the network name. As I said, it is correct, because I copied it from the fstab, where I set the share to automount, when I am in my office at the univ.

          – Faabiioo
          Dec 24 '13 at 10:11













          0














          First of all, you need to get the samba connection to work. NT_STATUS_BAD_NETWORK_NAME means the client wasn't able to find the share - check the typing (case, typos, etc.). It might be also connected to access rights on the server, so veryfying that it works from windows should be the first step.



          After that there are several ways to make it work. One involves tunnelling Samba through SSH: forwarding appropriate ports with ssh and then using Samba to connect to a port on your local machine (which is forwarded to the remote on-campus system). Alternatively, if you can mount the Windows share on the campus server and export it via SSHFS.






          share|improve this answer
























          • the connection error looked weird to me, as the path was copy/pasted. it is correct an normally works. I'm gonna try with the tunnelling

            – Faabiioo
            Dec 24 '13 at 9:12
















          0














          First of all, you need to get the samba connection to work. NT_STATUS_BAD_NETWORK_NAME means the client wasn't able to find the share - check the typing (case, typos, etc.). It might be also connected to access rights on the server, so veryfying that it works from windows should be the first step.



          After that there are several ways to make it work. One involves tunnelling Samba through SSH: forwarding appropriate ports with ssh and then using Samba to connect to a port on your local machine (which is forwarded to the remote on-campus system). Alternatively, if you can mount the Windows share on the campus server and export it via SSHFS.






          share|improve this answer
























          • the connection error looked weird to me, as the path was copy/pasted. it is correct an normally works. I'm gonna try with the tunnelling

            – Faabiioo
            Dec 24 '13 at 9:12














          0












          0








          0







          First of all, you need to get the samba connection to work. NT_STATUS_BAD_NETWORK_NAME means the client wasn't able to find the share - check the typing (case, typos, etc.). It might be also connected to access rights on the server, so veryfying that it works from windows should be the first step.



          After that there are several ways to make it work. One involves tunnelling Samba through SSH: forwarding appropriate ports with ssh and then using Samba to connect to a port on your local machine (which is forwarded to the remote on-campus system). Alternatively, if you can mount the Windows share on the campus server and export it via SSHFS.






          share|improve this answer













          First of all, you need to get the samba connection to work. NT_STATUS_BAD_NETWORK_NAME means the client wasn't able to find the share - check the typing (case, typos, etc.). It might be also connected to access rights on the server, so veryfying that it works from windows should be the first step.



          After that there are several ways to make it work. One involves tunnelling Samba through SSH: forwarding appropriate ports with ssh and then using Samba to connect to a port on your local machine (which is forwarded to the remote on-campus system). Alternatively, if you can mount the Windows share on the campus server and export it via SSHFS.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 23 '13 at 21:36









          peterphpeterph

          23.6k24457




          23.6k24457













          • the connection error looked weird to me, as the path was copy/pasted. it is correct an normally works. I'm gonna try with the tunnelling

            – Faabiioo
            Dec 24 '13 at 9:12



















          • the connection error looked weird to me, as the path was copy/pasted. it is correct an normally works. I'm gonna try with the tunnelling

            – Faabiioo
            Dec 24 '13 at 9:12

















          the connection error looked weird to me, as the path was copy/pasted. it is correct an normally works. I'm gonna try with the tunnelling

          – Faabiioo
          Dec 24 '13 at 9:12





          the connection error looked weird to me, as the path was copy/pasted. it is correct an normally works. I'm gonna try with the tunnelling

          – Faabiioo
          Dec 24 '13 at 9:12


















          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%2f106407%2faccess-windows-share-from-local-linux-machine-through-remote-ssh-server%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

          CARDNET

          Boot-repair Failure: Unable to locate package grub-common:i386

          濃尾地震