There are many guides that are written for this topic. I’ve looked at most of them and I’ve adapted this guide from an Ubuntu linux user, Strombringer.
Taken from its official website, “Samba is an Open Source/Free Software suite that has, since 1992, provided file and print services to all manner of SMB/CIFS clients, including the numerous versions of Microsoft Windows operating systems. Samba is freely available under the GNU General Public License.” SAMBA runs on almost all UNIX and UNIX-like platforms such as Linux, Solaris and BSD.
In this guide, SAMBA will be the gateway to a Linux OS from your Windows system. SAMBA allows users to share folders on their Linux system that can be accessible by a Windows system. On a Windows, it will look like a normal Windows directory, although what you are seeing is actually a Linux system. Linux administrators can specify what permissions (read/write) to give to which users. This ensures the security of the Linux file system.
Before we dig into the codes and commands, I would like to lay the necessary requirements needed for SAMBA to work properly.
1. You should try to get a static IP-address for your Linux box. (it will be so much less headache with static ip address)
2. Your windows system should be in the same network as your Linux box
3. You need to be connected to your internet.
4. I’m using Ubuntu Edgy for this tutorial.
If you do not have a SAMBA client installed in your Linux box, open up your client and type:
sudo apt-get install samba Configuring your SAMBA client
First, we need to make sure that SAMBA is not running.
sudo /etc/init.d/samba stop We need to create a new template for this tutorial. But before doing so, we’ll need to rename the old template so as to prevent a write over of the old one.
sudo /etc/samba/smb.conf /etc/samba/smb.conf.template Next, lets create a new file to put in our codes.
sudo touch /etc/samba/smb.conf Finally, we need to open the file in an editor. You can use nano, gedit or whatever editer you wanna use. Here, I’ll go for gedit.
sude gedit /etc/samba/smb.conf Copy and paste the contents below into your new smb.conf file.
[global]
; General server settings
netbios name = YOUR_HOSTNAME
server string =
workgroup = YOUR_WORKGROUP
announce version = 5.0
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192
passdb backend = tdbsam
security = user
null passwords = true
username map = /etc/samba/smbusers
name resolve order = hosts wins bcast
wins support = yes
printing = CUPS
printcap name = CUPS
syslog = 1
syslog only = yes
; NOTE: If you need access to the user home directories uncomment the
; lines below and adjust the settings to your hearts content.
;[homes]
;valid users = %S
;create mode = 0600
;directory mode = 0755
;browseable = no
;read only = no
;veto files = /*.{*}/.*/mail/bin/
; NOTE: Only needed if you run samba as a primary domain controller.
; Not needed as this config doesn't cover that matter.
;[netlogon]
;path = /var/lib/samba/netlogon
;admin users = Administrator
;valid users = %U
;read only = no
; NOTE: Again - only needed if you're running a primary domain controller.
;[Profiles]
;path = /var/lib/samba/profiles
;valid users = %U
;create mode = 0600
;directory mode = 0700
;writeable = yes
;browseable = no
; NOTE: Inside this place you may build a printer driver repository for
; Windows - I'll cover this topic in another HOWTO.
[print$]
path = /var/lib/samba/printers
browseable = yes
guest ok = yes
read only = yes
write list = root
create mask = 0664
directory mask = 0775
[printers]
path = /tmp
printable = yes
guest ok = yes
browseable = no
; Uncomment if you need to share your CD-/DVD-ROM Drive
;[DVD-ROM Drive]
;path = /media/cdrom
;browseable = yes
;read only = yes
;guest ok = yes
[MyFiles]
path = /media/samba/
browseable = yes
read only = no
guest ok = no
create mask = 0644
directory mask = 0755
force user = YOUR_USERNAME
force group = YOUR_USERGROUP
You will need to change certain lines from the codes above to configure SAMBA to your network. Firstly you have to tell SAMBA your network configuration so that it can communicate with your Windows box. For this tutorial, I’m going to make a dummy network for myself. You can change the network names, computer names and share folder names to your own desired settings.
Let say I have a workgroup called mynetwork and a Windows computer called wincom. The Linux box that I use as the server is called linuxcom with an account called firdooze. Change the settings as shown:
netbios name = linuxcom ; your desired hostname workgroup = mynetwork ; your workgroup name To find the name of your workgroup in Windows, you’ll need to do as follow:
1. hold the windows key + pause/break key (this will pop out the system settings).
2. Go to the “computer name” tab and look for your workgroup name.
wins support = yes If you don’t have a static ip-address and you cannot configure your router/server to provide you with a fixed dhcp-lease, change this configuration parameter to “no”.
Towards the bottom of the codes, [MyFiles] is the name of the share name that you want Windows to use to access the files in your server directory. Under this heading is all the properties of your share files and folders. You can rename it to whatever you want for example, instead of MyFiles, you can change it to mainsharedfolder or limitedsharedfolder. Most importantly, do not use more than 31 characters and avoid spaces!
path = /media/hdb1/share ; the path of your shared folder on Linux It is advisable to keep your shared folder on another partition or hard disk. Try not to share folders in your home folder. And of course this is just an example. You can use any path name as you wish.
force user = firdooze ; the name of your Linux login
force group = firdooze ; the name of your Linux login There! You’ve already completed editing the smb.conf file. Save the file and close it.
Next, there is still the last part in configuring the Windows OS so as to allow it to access the Linux machine. This will be much simpler than what you’ve gone through so far.
Firstly open your Network Connections. Right click the connection that you use to connect to the web (active connection) and click on properties.
General Tab > Find & click Internet Protocol (TCP/IP) > Properties …. next ….
General Tab> Advanced button > WINS > ADD
Under TCP/IP WINS server type in the local IP address of your Linux box.
For example : 192.165.12.101
Then check on the radio button > Enable NetBIOS over TCP/IP
You will need to restart your computer first before the settings take into effect.
Finally, there are a few ways that you can access your Ubuntu machine.
1. Mapping network drive (Permanent):
Right click My Computer > Map Network Drive > Choose a letter for the drive.
Under folder, type in the hostname/IP address and share folder.
i.e linuxcom\MyFiles (if you have WINS support) or 192.165.12.101\MyFiles
2. Entering address on the Explorer bar (Temporary Access):
Enter your hostname/IP address and share folder into the explorer bar.
i.e \\linuxcom\MyFiles or \\192.165.12.101\MyFiles
There you have it! A simple (but not 100% secure) way of sharing folders using Linux.






1 response so far ↓
1 Prasad.SR // Jul 10, 2008 at 8:19 pm
thanks good handy tuto.. but u hav missed smbpasswd. including that will fulfill the purpose i think so..
Leave a Comment