How to install and Configure SAMBA in Debian Squeeze

If you want to share files between your Debian and Windows computers, your best option is to use Samba file sharing.debian

Samba is a free software re-implementation of SMB/CIFS networking protocol, originally developed by Australian Andrew Tridgell. As of version 3, Samba provides file and print services for various Microsoft Windows clients and

can integrate with a Windows Server domain, either as a Primary Domain Controller (PDC) or as a domain member. It can also be part of an Active Directory domain.Samba runs on most Unix and Unix-like systems, such as Linux, Solaris, AIX and the BSD variants, including Apple’s Mac OS X Server (which was added to the Mac OS X client in version 10.2). Samba is standard on nearly all distributions of Linux and is commonly included as a basic system service on other Unix-based operating systems as well. Samba is released under the GNU General Public License. The name Samba comes from SMB (Server Message Block), the name of the standard protocol used by the Microsoft Windows network file system.  (Wikipedia)

1-Specify  the  Samba Server

lets give my example server with IP


2- Install Samba

open  terminal and  install samba package and dependencies

$sudo apt-get install libcupsys2 samba samba-common

You will see the following questions:

Workgroup/Domain Name: <– WORKGROUP

Enter a workgroup name

Edit the smb.conf file using the command:

vi /etc/samba/smb.conf

Now activate  the  line security = user


# “security = user” is always a good idea. This will require a Unix account

# in this server for every user accessing the server. See

# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html

# in the samba-doc package for details.

security = user


This enables Linux system users to log in to the Samba server.

save , exit and restart Samba:

/etc/init.d/samba restart


3- Add the Samba Shares

This will add a share that will be accessible from  all users.

Create the directory for sharing the files and change the group to the users group:

mkdir -p /home/samba-share/allusers
chown -R root:users /home/samba-share/allusers/
chmod -R ug+rwx,o+rx-w /home/samba-share/allusers/

At the end of the file /etc/samba/smb.conf add the following lines:

First open the smb.conf file using the command:

vi /etc/samba/smb.conf

and add:


comment = All Users

path = /home/samba-share/allusers

valid users = @users

force group = users

create mask = 0660

directory mask = 0771

writable = yes

If you want all users to be able to read and write to their home directories via Samba, add the following lines to /etc/samba/smb.conf:



comment = Home Directories

browseable = no

valid users = @users

writable = yes

create mask = 0700

directory mask = 0700

save and restart Samba:

/etc/init.d/samba restart


Dont  forget  to set  read only  to  noin the config file

# By default, the home directories are exported read-only. Change the# next parameter to 'no' if you want to be able to write to them. read only = no

4 Add and manage the Users

In this example, I will add a user named tom. You can add as many users as you need in the same way, just replace the username tom with the desired username in the commands.

useradd  samba-user -m -G users

Set a password for samba-user in the Linux system .

-> Enter the password for the new user.

root@unixmen-debian6:~# passwd samba-userOutputEnter new UNIX password: Retype new UNIX password: 

Now add the user to the Samba user database:

root@unixmen-debian6:~# smbpasswd -a samba-userOutputNew SMB password:Retype new SMB password:Added user samba-user.root@unixmen-debian6:~# 

Now you should be able to log in from your Windows workstation with the file explorer (address is  or  for samba-user  home directory)

login to the samba server

login to you home  directory


    thanks for this post…

  • Matt

    I’m trying to connect to my internet radio which accepts the SMB protocol. I’ve followed the instructions above. It recognizes my machine but, It cannot find the shared folder (/home/samba-shares/allusers)
    I’m not entirely sure what permissions to assign to it. I’ve tried to assign it to samba-user with the users group.
    I am trying to connect a Grace Digital Audio player (model GDI-IR2000) which claims to support SMB protocol. Any pointers?

  • Ryan Marcus

    I just went through this — everything works well, but you have to make a few more changes in order for Samba to follow symlinks OUTSIDE of the shared directory.

    Add this to your global section (it has to be in the global section. Not the section for the share. The global section.)

    unix extensions = no
    wide links = yes

  • pirat9

    Thx Ryan Marcus
    i will update the article today later .

  • Matt

    Yeah, Thanks! This was by far the most lucid, well written article for samba installations. Every suggestion I’ve come across lists different options, philosophies and rationale for the config files. This makes sense.
    I also installed WebMin, a really easy server management tool and was able to make quick changes to the smb.conf and view results
    I gave up trying to get samba to serve folders for my internet radio and removed it though (Was going to opt for a UnPnP server or the like) which caused the radio to stop working all together for some reason (?!). I told the folks in their service department, "It’s like if the car factory burnt down and all of the sudden my car stops working."

  • ken

    Thank you for the excellent and easy to understand tutorial

  • McmillanYoung

    It’s known that money can make us independent. But how to act when one has no money? The one way is to get the home loans and sba loan.

  • HahnShelia

    That’s cool that we are able to get the home loans moreover, that opens completely new chances.

  • capillotraktor

    Thanks a lot, very good tutorial for samba newbies like me:-)

  • Wondu Nura

    Thank you for the all document.

  • George

    It seems not ok with Windows 7 Professional

  • NoobDev

    thanks for this.

  • Asd

    How do I share a printer with samba?

  • stev

    jepp it worked…now i have to figure out how i can put the LDAP Users into the Samba Server, but its good fun, thanks!


  • linux

    good work, thank you

  • Robert

    great, finally a how-to, which worked. thanks a lot

  • Pingback: Quick guide to config a samba server on debian to share files between windows and linux | Tomato Blog()

  • Emerson

    Otimo !!!

  • J. E. Godoy

    when I try tu do the line chmod -R root:users /home/samba-share/allusers… chmod invalid <> what is the meaning of :users is the groups on samba or the user for windows have to be the same on linux ??

  • Enable15

    FYI – Instructions do not work on a default install of Debian Wheezy.

  • Bogdan

    Was able to connect from Windows 2008 to Debian Wheezy.

    I followed your all of your instructions and worked.
    Thank you very much.

  • Mohammad

    It’s work 100%

    [Stand-alone]Debian Wheezy Windows 7 Ultimate.
    just avoid doing in step 3: [home] and # By default, the home directories…..


  • Pingback: Samba | Linux Residential Gateway()