Linux - How to transfer/copy files via a network connection using Samba between Linux and Windows

About Samba

Samba allows Linux computers to share files and printers across a network connection. By using its SMB protocol, your Linux box can appear in Windows Network Neighbourhood or My Network Places just like any other windows machine. You can share files this way, as well as printers.

Installation and configuration Steps

Install the Samba application

If you use Oracle Entreprise Linux 5 (of Red Hat, Cent), you will find the rpm installation package in the directory

/media/Entreprise Linux dvd 20090127

Install the 4 rpm files.

You may need to install a perl package before

Once the installation is done, you can test ii with this command : rpm -q samba

[[email protected] ~]# rpm -q samba

The command give us the file and the version name if it's installed of otherwise :

package samba is not installed

Configuration of Samba

The configuration of Samba occur in the file /etc/samba/smb.conf. You can modify it manually or best by using the web-based swap interface.

Below my smb.conf file. You can find the documentation about the parameters in the original smb.conf file or in the documentation Samba-HOWTO-Collection.

# Samba config file created using SWAT
# from (
# Date: 2009/10/15 13:29:18

	workgroup = MYGROUP
	server string = Samba Server Version %v
	passdb backend = tdbsam
	cups options = raw

	comment = Home Directories
	read only = No

	comment = All Printers
	path = /var/spool/samba
	read only = No
	guest ok = Yes
	printable = Yes
	browseable = No

	comment = Public Stuff
	path = /home/samba
	write list = +staff
	read only = No
	guest ok = Yes

How to add a user

A samba user must be a Linux user. To add it to samba, you do it by using the command smbpasswd as :

[[email protected] ~]# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.

Test the installation

From the windows platform

  • Get the ip address of the linux system (with Linux - ifconfig (Interface Configuration))
  • Open the repository browser and tape an UNC address
  • Enter the credential of a user define above
  • And you must see the shared map.

From the linux platform

To test the installation, you use the smbclient application and you must give a UNC name.

Example :

[[email protected] ~]# smbclient //localhost/homes
Domain=[OEL11G] OS=[Unix] Server=[Samba 3.0.33-3.7.el5]
smb: \> 


perl(Convert::ASN1) is needed

[[email protected] Server]# rpm -i samba-3.0.33-3.28.el5.x86_64.rpm
error: Failed dependencies:
        perl(Convert::ASN1) is needed by samba-3.0.33-3.28.el5.x86_64
[[email protected] Server]# rpm -i perl-Convert-ASN1-0.20-1.1.noarch.rpm
[[email protected] Server]# rpm -i samba-3.0.33-3.28.el5.x86_64.rpm

Powered by ComboStrap