Samba is a print and file sharing implementation of the SMB/CIFS protocol that is free and open source. Samba provides seamless file and print services to Linux and Windows clients alike. While the clients may be Windows the file/print server will be a Linux/Unix-like system. In this tutorial I will demonstrate the necessary steps to set-up a simple Samba server on Ubuntu Server 8.04. By simple I mean the resulting share will not require and kind of authentication to access the shares.
Start by installing Samba from the Ubuntu repositories by using apt-get.
sudo apt-get install samba
Now we are going to make changes to the Samba configuration.
/etc/samba/smb.conf
I will be using nano a text editor. Edit with your text editor of choice:
sudo nano /etc/samba/smb.conf
Close to the top of the configuration file below Global Settings you will find the option to change the workgroup to match that of your network.
workgroup = WORKGROUP
The security option is commented (remove semicolon) the default is set to user change it to share to match the new configuration.
security = share
Now we add the options for our new file share, I recommend you add the following options to the bottom of the configuration file.
[share]
comment = Ubuntu File Server Share
path = /media/mydrive/myshare
browsable = yes
guest ok = yes
read only = no
create mask = 0755
Create a new directory where the files you wish to share will reside. -p if necessary it will create the directory tree.
sudo mkdir -p /media/mydrive/myshare
Change ownership to.
sudo chown nobody.nogroup /media/mydrive/myshare/
Restart Samba and wait for the changes to take effect.
sudo /etc/init.d/samba restart
To make sure the configuration file is clear of typos or missing options you should run testparm to check for any errors.
testparm smb.conf
Load smb config files from smb.conf
Processing section “[printers]“
Processing section “[print$]“
Processing section “[share]“
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
After we are done setting up the server side configuration we move on to the Windows client. Go to Start > My Computer > and click on Map network drive. In the Map Network Drive window enter the IP address and share name, click on Finish to continue. Go back to My Computer and in the Network Location section you should be able to see the mounted share (name and IP address). Congratulations, you have just set up a simple file server on Linux and configured the Windows client. In future posts I will go into securing a share.
file share, linux, samba, smb, ubuntu — May 17, 2010