Sharing files and printers with Windows machines is something that sooner or later you will have to do. If you are using Linux as you only operating system, you really a great chance to have to share something with the windows universe, unfortunately they are more than us.

But do not worry Samba is here to save you.

We will see here a simple yet effective samba configuration file, that will give you a good idea about how it works, and how you can share files and printers between Linux and Windows.

Install Samba

Well, use you package manager to do it, I will show how to do it in Debian and Arch Linux, just as an example.

aptitude install samba

For Debian, and:

pacman -S samba

For Arch Linux, I’m sure you will how to do it for your Linux distribution.

Samba configuration file

You may find it at: /etc/samba/smb.conf if not look for it with:

find / -name smb.conf

Here is how mine looks:


   workgroup = MYGROUP
   server string = Samba Server
   security = share
   hosts allow = 10.1.1. 127.
   load printers = yes
   log file = /var/log/samba/%m.log
   max log size = 50

#============================ Share Definitions ==============================
   comment = Home Directories
   browseable = no
   writable = yes

   comment = All Printers
   path = /var/spool/samba
   browseable = yes
# Set public = yes to allow user 'guest account' to print
   guest ok = yes
   writable = no
   printable = yes
   create mode=0700
#  write list=@adm root neocephas
printer admin = root

comment = HP LaserJet P1006
printable = yes
path = /var/spool/samba
public = yes
guest ok = yes
printer admin = root

Well, this file, is just a simple example, but it will work for most of the cases.

If you already have a workgroup, change MYGROUP for your own workgroup.

host allow lets you define which networks will have access to shares, in my case, my office uses, yours can be different.

You can see, I am sharing an HP LaserJet P1006, which is installed on my PC and managed via CUPS.

One important thing I have changed from the default configuration file is:

In the global section, security from user to share, this let every user to print on my printer with no need to use a user and password, yes, you are right, it is not as secure as using user and create pairs of users/passwords, but I do not need that in my office, and I like to keep things simple.

If you prefer to use more security, you will have to keep

security = user

In the global section, and use

smbpasswd -a [user]

To create users/password for the samba server, those users, should exist on the system so you will have to add them with useradd