Samba is the standard Windows interoperability suite of programs for Linux and Unix. Samba is Free Software licensed under the GNU General Public License, the Samba project is a member of the Software Freedom Conservancy. Since 1992, Samba has provided secure, stable and fast file and print services for all clients using the SMB/CIFS protocol, such as all versions of DOS and Windows, OS/2, Linux and many others. Samba is an important component to seamlessly integrate Linux/Unix Servers and Desktops into Active Directory environments using the winbind daemon.
To install samba on Ubuntu, run
Below command will install SAMBA server / client applications, smbfs (to mount windows filesystem using samba)
sudo apt-get install samba smbclient smbfs
To configure samba server you need to edit /etc/samba/smb.conf. After making change, you need to reload smb service. Before doing any changes we will be taking backup of original / existing smb.conf file.
cat /etc/samba/smb.conf | grep -v "^#" | grep -v "^;" | grep . > /tmp/smb.conf mv /etc/samba/smb.conf /etc/samba/smb.conf.bak mv /tmp/smb.conf /etc/samba/smb.conf
Now we will be sharing our movies directory with windows network. To do so you need to edit smb.conf and have to add share information. Add following lines in /etc/samba/smb.conf file.
[movies] comment = movies path = /movies browsable = yes writeable = yes public = yes
Restart smb service to apply the changes
sudo /etc/init.d/smbd restart
To access the above share in windows, go to start > run > and type
To access the above share in linux, run
Above share is writeable and readble to every user.
If you want to share information in read only manner and readable only to particular user then do following changes in above configuration.
[movies] comment = movies path = /movies browsable = yes user = techienote revalidate = yes
Now you need to add user techienote to smb server.
useradd techienote smbpasswd -a techienote
To apply changes restart smb server
Samba server use following ports, so you must open following ports on your firewall
port type port no udp 137 udp 138 tcp 139 tcp 445