Tags

, , ,

Samba allows us to share out or retrieve shared files from Windows.

To share out files from Debian.

Install package files samba, smbclient and smbfs.

apt-get install samba smbclient smbfs

 

Stop the Samba service.

service samba stop

 

Create a backup of the default configuration file.

mv /etc/samba/smb.conf /etc/samba/smb.conf.bak

 

Create a directory that will be shared out with Samba.

mkdir -p /srv/samba/tmp
 chmod 1777 /srv/samba/tmp

 

Create a new Samba configuration.

nano /etc/samba/smb.conf

 

basic configuration for smb.conf

[global]
 workgroup = WORKGROUP
 netbios name = debian
 
[tmp]
 path = /srv/samba/tmp
 writeable = yes
 guest ok = yes

 

Exit the text editor and verify the configuration file’s syntax.

testparam

 

Start the Samba service.

service samba start

 

Create user accounts to access the shared directory.

useradd windowsuser
 smbpasswd -a windowsuser

 

Map the shared directory on a Windows client.

//debian/tmp

 

To access a Windows shared directory from debian.

There are several methods to access Windows shared directory. One of it is to access it using smbclient which is like accessing an ftp server. Another is method is to mount the directory onto the debian client and access it like an NFS server.

Share c:\Users\Public on Windows.

Make sure that netbios over TCPIP is enabled on the Windows client.

On Debian.

smbclient //WindowsServer/Public -U Administrator

 

Once logged on, we should now be able to retrieve files from the Windows client.

To mount the Windows shared directory onto the Debian client, make sure that the Debian client is able to resolve the Windows server’s computer name into ip address.

Create a directory for mounting

mkdir -p /mnt/tmp

 

Mount the directory.

mount -t cifs -o username=Administrator //WindowsServer/Public /mnt/tmp

 

You should now be able to see the files in /mnt/tmp.

 

To have the directory automatically mounted upon rebooting.

Open up /etc/fstab.

nano /etc/fstab

 

Add the following line.

//Windows/Public /mnt/tmp cifs default,user,username=Administrator,password=Admin123456 0 0

 

Save and exit the text editor.

Do a mount -a and check if the directory is mounted onto /mnt/tmp

Advertisements