blog.up-link.ro
1Apr/100

How To Access SAMBA shares through SSH in Linux

You can access Samba shares by using SSH tunneling. We need a host computer (x.y.z.w) and a destination computer (192.168.0.1, is located in the x.y.z.w network), we'll use adi as username and pass as password.

First we'll create a new mount directory:

# mkdir -p /mnt/share

Now we connect to it:

# ssh -N -L 139:192.168.0.1:139 adi@x.y.z.w

Now we have to run the following commands:

# umount /mnt/share

# mount -t smbfs -o username=adi,workgroup=WORKGROUP,password=pass,port=139,dmask=770,fmask=660,netbiosname=computer1 //localhost/share /mnt/share

x.y.z.w=computer's IP address
192.168.0.1=destination computer
adi=samba username
WORKGROUP=your workgroup
pass=password for the share

Print This Post Print This Post