Fading Coder

An Old Coder’s Final Dance

Home > Tech > Content

Configure Samba to Share Users’ Home Directories

Tech 2

1. Install required packages

On Debian/Ubuntu systems:

sudo apt-get update
sudo apt-get install -y samba samba-common-bin openssh-server

2. Enable the per-user home share in smb.conf

Back up the current configuration, then edit it:

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
sudo nano /etc/samba/smb.conf

Locate the [homes] section (it is usually commented out) and define it like this:

#======================= Share Definitions =======================
[homes]
   comment = User Home Directories
   browseable = no
   read only = no
   create mask = 0644
   directory mask = 0755
   valid users = %S

Save the file and exit the editor.

Optionally validate the configuration syntax:

sudo testparm

3. Restart Samba serivces

Use systemd (preferred on modern distributions):

sudo systemctl restart smbd nmbd

If your system uses the legacy service command:

sudo service smbd restart
sudo service nmbd restart

4. Create a Samba password for an existing user

Assume there is already a local Linux user named alice:

sudo smbpasswd -a alice

Enter a Samba password when prompted. This does not change the user’s Unix paswsord.

5. Connect from Windows

In File Explorer’s address bar, enter the UNC path to the user’s home share:

\\<server-ip-or-hostname>\alice

Note: Use the username directly, not a path like \\home\alice.

Windows will prompt for credentials. Provide the username (alice) and the Samba password set with smbpasswd.

6. Map the share as a network drive on Windows

  • Open File Explorer and select This PC
  • Click Map network drive on the toolbar
  • Choose a drive letter
  • In Folder, enter \\alice
  • Check Connect using different credentials if needed, then finish

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.