HomeContact

Setting Up Samba on Proxmox A Detailed Guide

By Shady Nagy
February 14, 2025
2 min read
Setting Up Samba on Proxmox A Detailed Guide

Table Of Contents

01
Introduction
02
Step 1: Identify and Prepare the Storage Drive
03
Step 2: Configure Persistent Mounting
04
Step 3: Install Samba
05
Step 4: Configure Samba
06
Step 5: Start and Enable Samba Services
07
Step 6: Create a Samba User
08
Step 7: Set Permissions
09
Step 8: Restart Samba Services
10
Conclusion
11
Feedback and Questions

Introduction

Samba is a powerful and flexible tool that enables file sharing between Linux and Windows systems. In this guide, I will walk through the detailed steps to install and configure Samba on a Proxmox server.

Step 1: Identify and Prepare the Storage Drive

Before setting up Samba, we need a dedicated storage partition where shared files will be stored.

  1. List Available Storage Devices:

    lsblk

    This command lists all the block devices (storage drives) connected to the server. It helps us identify the correct disk to use.

  2. Check the Partition’s UUID:

    blkid /dev/sdb1

    This command displays the UUID (Unique Identifier) of the partition /dev/sdb1, which will be useful for mounting the drive persistently.

  3. Format the Partition with EXT4 Filesystem:

    mkfs.ext4 -L Storage /dev/sdb1

    This formats the partition with the EXT4 file system and labels it as Storage.

  4. Create a Mount Point:

    mkdir -p /mnt/storage

    This command creates a directory where we will mount the storage drive.

  5. Mount the Partition:

    mount /dev/sdb1 /mnt/storage

    This mounts the newly formatted partition to the /mnt/storage directory.

Step 2: Configure Persistent Mounting

To ensure that the partition is mounted automatically at boot, we need to add an entry to /etc/fstab.

  1. Edit fstab:

    nano /etc/fstab

    Add the following line to the file:

    UUID=01c126f6-5a2a-46b8-9f1b-475720978b8f /mnt/storage ext4 defaults,noatime 0 0

    Replace the UUID with the actual UUID of the partition found using the blkid command.

  2. Apply the Changes:

    mount -a

    This mounts all the filesystems defined in /etc/fstab.

Step 3: Install Samba

Now, we install the Samba package to enable file sharing.

apt update && apt install samba

This command updates the package list and installs Samba.
If you have error check (this)[https://shadynagy.com/how-to-fix-proxmox-update-errors-step-by-step-guide/].

Step 4: Configure Samba

  1. Edit Samba Configuration File:
    nano /etc/samba/smb.conf
    Add the following section at the end of the file:
    [Storage]
    path = /mnt/storage
    writable = yes
    browseable = yes
    guest ok = no
    valid users = smbuser
    • path = /mnt/storage: Specifies the shared directory.
    • writable = yes: Allows writing files to the share.
    • browseable = yes: Makes the share visible on the network.
    • guest ok = no: Prevents guest access.
    • valid users = smbuser: Restricts access to the user smbuser.

Step 5: Start and Enable Samba Services

We need to enable and start the Samba services to ensure it runs automatically on boot.

systemctl enable smbd nmbd
systemctl start smbd nmbd
  • smbd: Handles file sharing services.
  • nmbd: Manages network name resolution.

Step 6: Create a Samba User

A Samba user is required for authentication.

  1. Create a New User:

    useradd -m -s /bin/bash smbuser

    This command creates a new user named smbuser.

  2. Set a Password for the User:

    passwd smbuser
  3. Add the User to Samba:

    smbpasswd -a smbuser

    This command sets a Samba-specific password for smbuser.

Step 7: Set Permissions

We need to grant the user permission to access the storage directory.

chown -R smbuser:smbuser /mnt/storage

This command changes the ownership of /mnt/storage to smbuser.

Step 8: Restart Samba Services

To apply all changes, restart the Samba services:

systemctl restart smbd nmbd

To verify that Samba is running correctly, check its status:

systemctl status smbd nmbd

Conclusion

Now, the Samba server is up and running. You can access the shared folder from a Windows machine by entering \\your-server-ip\Storage MAC (smb://your-server-ip/Storage) in the File Explorer.
This guide ensures that the configuration is persistent across reboots, secure, and accessible only to authorized users.

Feedback and Questions

Your insights drive us! For any questions, feedback, or thoughts, feel free to connect:

  1. Email: shady@shadynagy.com
  2. Twitter: @ShadyNagy_
  3. LinkedIn: Shady Nagy
  4. GitHub: ShadyNagy

If you found this guide beneficial, don’t hesitate to share it with your network. Until the next guide, happy coding! 🚀


Tags

#Samba#VM#Proxmox

Share


Previous Article
Fixing Proxmox Update Errors A Step-by-Step Guide
Shady Nagy

Shady Nagy

Software Innovation Architect

Topics

AI
Angular
dotnet
GatsbyJS
Github
Linux
MS SQL
Oracle

Quick Links

Contact Us

Social Media