Setting Up Samba Server on Debian 7

by February 25, 2015 0 comments

Samba is an Open Source and free software that provides file and print services to SMB/CIFS clients. It allows for interoperability between Linux/Unix servers and Windows-based clients

First download and install Debian 7 on the system where you have to install the Samba server. You also need one Windows machine to check the Samba server on the same network where you have the Debian machine.

Step1: The Windows machine must be on same workgroup. To check the value on the Windows machine run the following at cmd prompt:

  net config workstation

It will be like this:


Your Windows machine must be in the same domain as the Debian server, i.e. WORKGROUP in my case.

Step2: To access Debian server from the Windows machine you must know server’s IP address. Type the following command:

  Sudo ifconfig

Step 3: Type the following command to install samba server:

  sudo apt-get install libcupsys2 samba samba-common

 Step4:Add the Samba Shares. 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/
 Now to configure samba edit the file /etc/samba/smb.cnf before making changes,
 I will take the backup of original file as /etc/samba/smb.cnf.bak
 mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
 Now edit this file and write the lines given below:
 nano /etc/samba/smb.cnf
 comment = All Users
 path = /home/samba-share/allusers
 valid users = @users
 force group = users
 create mask = 0660
 directory mask = 0771
 writable = yes
 comment = Home Directories
 browseable = no
 valid users = @users
 writable = yes
 create mask = 0700
 directory mask = 0700

Now restart the Samba server:

 service samba restart

Step5: Now you can access the Debian share in Windows. Open the Run command and type the IP address of the Debian smb sever given in the first step.



Step6: Add and manage the Users. In this example, I will add a user named test. You can add as many users as you need in the same way, just replace the username test with the desired username in the commands.

  useradd test -m -G users

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

-> Enter the password for the new user.

  passwd test

Now add the user to the Samba user database:

  smbpasswd -a test

Now you should be able to log in from your Windows workstation with the file explorer and login to the samba server.

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.

Your data will be safe!Your e-mail address will not be published. Also other data will not be shared with third person.