There is a new version of this tutorial available for Debian 9 (Stretch).

Debian 4.0 (Etch) Samba Standalone Server With tdbsam Backend

This tutorial explains the installation of a Samba file server on Debian Etch and how to configure it to share files over the SMB protocol as well as adding users. Samba is configured as a standalone server, not as a domain controller. To configure Samba as a domain controller, have a look at this howto:

In the resulting setup, every user has its own home directory that is accessible via SMB protocol and all users have a shared directory with read/write access.

Installing Samba

Install the Debian Samba packages:

apt-get install libcupsys2 samba samba-common

Answer the following questions:

Please specify the workgroup you want this server to appear to be in when queried by clients. Note that this parameter also controls the domain name used with the security=domain setting.
Workgroup/Domain Name:

-> workgroup

If your computer gets IP address information from a DHCP server on the network, the DHCP server may also provide information about WINS servers ("NetBIOS name â servers") present on the network. This requires a change to your smb.conf file so that DHCP-provided WINS settings will automatically be read from /etc/samba/dhcp.conf.
The dhcp3-client package must be installed to take advantage of this feature.
Modify smb.conf to use WINS settings from DHCP?

-> no

Edit the smb.conf file:

vi /etc/samba/smb.conf

In the global section, remove the ";" at the front of the line security = user so it looks like this:

security = user

to enable Linux system users to log in to the Samba server.

In the section [homes] change writable = no to:

writable = yes

Close the file and restart Samba:

/etc/init.d/samba restart

Now I will add a share that is accessible by all users.

Create the directory for sharing the files and change the owner to the users group.

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

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

  comment = All Users
  path = /home/shares/allusers
  valid users = @users
  force group = users 
  create mask = 0660
  directory mask = 0771
  writable = yes

Now we restart Samba:

/etc/init.d/samba restart

Adding And Managing 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 tom -m -G users

Now add the user to the Samba user database.

smbpasswd -a tom

-> Enter the password for the new user

Now you should be able to log in from your Windows workstation with the file explorer using the username tom and the chosen password and store files on the Linux server either in tom's home directory or in the public shared directory.

Share this page:

2 Comment(s)