How To Set Up a Samba Server in Ubuntu

So you have a Linux desktop or server and want to share files and/or printers to your Windows PCs or Macs. Luckily, all three operating systems support SMB so let’s use that. With Samba you can share files and printers on your home network and protect your shares with a username and password.
Install
First, fire up a terminal window and install the Samba server and GUI Configuration Tool:
sudo apt-get install samba system-config-samba
Once finished the configuration tool can be found under System > Administration > Samba
Settings
Make sure the workgroup matches that of your Windows PCs by going to Preferences > Server Settings. If you are using Windows 7 or Vista, it’s “workgroup” (and Samba should already be set to that). If XP, it’s usually “mshome”.
Create a username and password to secure the shares by going to Preferences > Samba Users and click on “Add User.” Add as many users as you need.
Unix Username: Pick the linux user account
Windows Username / Samba Password: The Windows username and samba password will be used for authentication when accessing the share.
Shares
Time to add a share. Click the “+” button.
Directory: This is the directory which you want to share.
Share Name: The share name will be the name that will appear when you browse the server.
Description: This will not be shown over the network and is just for organization.
Writable: Check if you want to be able to write to the folder.
Visible: When checked, the share will be visible to users who browse the server. If unchecked, it will not be visible but is still accessible explicitly.
In the Access tab, set permissions by checking the users who may access this share.
Accessing the Share
Back in Windows, access the samba server by opening an Explorer window and entering in the address bar:
\\[ip address of the samba server]
To access a hidden share:
\\[ip address of the samba server]\[hidden share name]
When opening a share for the first time, Windows may prompt for a username and password. Just enter the username and password created earlier.
And now you have a fully functioning Samba server.
Note: The GUI config tool is pretty basic. More advanced options can be set in the /etc/samba/smb.conf file. If this is edited, you can restart Samba server without rebooting:
sudo /etc/init.d/samba restart
