Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

as you can read from the title, this question might sound tricky, but I believe it is feasible.

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.