Monday, September 17, 2012

Share a directory with windows using samba to everybody in the local network

Samba is a free software implementation of the SMB/CIFS networking protocol, originally developed by Andrew Tridgell. it alows people to share files between  Linux machine and Window Machine.

To install samba run tis command:

sudo apt-get install samba

-First let's make sure only your local network can access samba service. Open and edit /etc/samba/smb.conf


interfaces = lo eth0
bind interfaces only = true
lo an eth0 should your network interfaces name run (ifconfig) to get the right names.
-To share a directory with everybody withour login/password: change security to share instead of user than enable guest account:
security = share
guest account = nobody
-Now, you can create a share to be accessible to users:

[public]
    comment = this folder is accessible by everybody
    path = /tmp #path the dir to share
    browseable = yes
    read only = yes
    guest ok = yes
To allow people to write to directory change  read only to no and add the folowing
writable=yes
You can test you configuration using the command
$testparm
If everything is fine, reload samba service to have your new configuration taken into account:
#ubuntu
$sudo /etc/init.d/samba reload
or
$sudo reload samba
#debian
$/etc/init.d/smbd reload
Or just
$reload smbd
That's all, anybody in your local network have now access to the folder /tmp.