A Debian file server gives you a single place to store files and share them across your local network. Using Samba to set up a file server on Debian is usually the best option to start with. It lets you create shared folders that users can access from a Windows, macOS or Linux computer.

Step 1: Prepare your server and storage

Before you start, make sure your server already has Debian 13 installed and is reachable over the network. For a basic file server, you don’t need high-end hardware. A multi-core CPU, enough RAM and suf­fi­cient storage space for your data will do.

For a file server, storage capacity and re­li­a­bil­i­ty matter most. Your hard drive or SSD needs enough space for your files and your server should be stable enough for everyday use. If several people need to open or save large files at the same time, faster storage and a stable gigabit network con­nec­tion will make a no­tice­able dif­fer­ence. It’s also worth knowing which devices will need access to the file server. That way, you can plan user accounts and access rights in advance.

Dedicated Servers
Per­for­mance through in­no­va­tion
  • Dedicated en­ter­prise hardware
  • Con­fig­urable hardware equipment
  • ISO-certified data centers

What kind of server should you use?

For a home file server or a small team setup, a VPS is often enough, es­pe­cial­ly if your storage needs are modest and only a few users will move large files at the same time. A dedicated server or bare metal server is usually the better choice if you’re working with larger amounts of data, several users at once or multiple hard drives. Generally speaking, a dedicated server gives you more control over the hardware, storage layout and I/O per­for­mance. It also makes it easier to use RAID or set up a dedicated backup strategy.

If the same physical server will handle more than file storage, you can run the server in a virtual machine (VM). Platforms like Proxmox make it easier to separate the file server from the rest of the system. For example, a Proxmox file server can run in its own VM while the host runs other server tasks.

If your main goal is to store photos, documents or backups in one place, focus on storage capacity and a solid CPU rather than powerful graphics hardware. A GPU server typically isn’t needed either, unless the same server also needs to handle AI workloads, media analysis or video transcod­ing.

Step 2: Update Debian

Before you set up the file server, log in to your server via SSH or through the server console. Then update Debian 13 so you have the latest bug fixes and security patches. Do so using these commands:

sudo apt update 
sudo apt upgrade -y
bash

Step 3: Install Samba

The next step is to install Samba. Samba is open-source software that lets a Linux system act as a file and print server on your network. It uses the SMB/CIFS protocol, which is the standard file sharing protocol used by Windows and also supported by macOS and Linux. The samba package includes the com­po­nents you need to run Debian as a stand­alone file server. You can install Samba using the following command:

sudo apt install samba smbclient samba-common-bin -y
bash

After the in­stal­la­tion, check if Samba is available:

smbd --version
bash

If the Samba version number appears, the in­stal­la­tion was suc­cess­ful.

Step 4: Create a shared folder

Now create the folder you want to share on the network. In this example, we’ll use /srv/fileshare, a common location for files provided by a server. Start by creating the folder:

sudo mkdir -p /srv/fileshare
bash

Next, set some basic per­mis­sions. For this setup, give one dedicated user access to the folder. Later, you’ll use that user to connect to the file server.

sudo useradd -m fileserveruser 
sudo passwd fileserveruser 
sudo chown -R fileserveruser:fileserveruser /srv/fileshare 
sudo chmod -R 770 /srv/fileshare
bash

The passwd command sets a local Linux password for the user. Samba will use its own password later, but the user account still has to exist on the Debian server. The 770 per­mis­sions limit who can access the folder. The owner and group can read, write and open files. Other users have no access. For an internal Debian file server, this is much safer than making the shared folder available to everyone.

Step 5: Adjust the Samba con­fig­u­ra­tion

Before you edit the Samba con­fig­u­ra­tion, back up the current file, so you have a safe copy in case you need to restore the original settings later. The main Samba con­fig­u­ra­tion file is usually found at /etc/samba/smb.conf. Copy the file and open it with these commands:

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 
sudo nano /etc/samba/smb.conf
bash

Add this section to the end of the file:

[global] 
workgroup = WORKGROUP 
 
[Fileshare] 
path = /srv/fileshare 
browseable = yes 
writable = yes 
valid users = fileserveruser 
create mask = 0660 
directory mask = 0770
txt

The first lines set the workgroup, in this case WORKGROUP. A workgroup is a simple Windows network group that helps devices find each other on a local network. Adjust this value if your network uses a different workgroup. The next section defines a Samba share named Fileshare. In Samba, a share is a folder that is made available over the network. Here, that share points to the /srv/fileshare directory. The writable = yes setting allows write access. The valid users line restricts access to the user you list there. The create mask and directory mask settings define the default per­mis­sions for new files and folders. Samba uses pa­ra­me­ters like these as part of the standard smb.conf con­fig­u­ra­tion.

Keep the setup secure by disabling outdated protocols such as SMB1 and using at least SMB2 or SMB3. Limit access to trusted IP addresses (with hosts allow) and enable SMB signing or en­cryp­tion to prevent tampering and keep unwanted users out.

Note

Make sure your firewall or local network allows the ports Samba needs. For current SMB access, TCP 445 is the main one. Depending on your setup, you may also need TCP/UDP 137/138 and TCP 139. If these ports are blocked, the file server may not be reachable even when the Samba con­fig­u­ra­tion is correct.

Step 6: Create a Samba user

The Linux user you created earlier is only part of the setup. Samba uses its own user database, so you also need to add that user to Samba. Start by setting a Samba password for fileserveruser:

sudo smbpasswd -a fileserveruser
bash

Then enable the Samba account:

sudo smbpasswd -e fileserveruser
bash

Step 7: Check the con­fig­u­ra­tion and restart Samba

Before you restart Samba, test the con­fig­u­ra­tion. This helps you catch typos or invalid settings in smb.conf up front.

testparm
bash

If testparm does not report any errors, restart the Samba services. Then enable them so they start au­to­mat­i­cal­ly when the server boots:

sudo systemctl restart smbd nmbd 
sudo systemctl enable smbd nmbd
bash

Finally, check Samba is running:

sudo systemctl status smbd
bash

The status should show “active (running)”.

Step 8: Access the file server on the network

Now test access to the Debian file server from another device on the same network. On Windows, open File Explorer and enter \\SERVER-IP\Fileshare. On macOS, open Finder and use: smb://SERVER-IP/Fileshare. On Linux, enter smb://SERVER-IP/Fileshare in your file manager. Log in with the Samba user and the Samba password you set earlier. In this example, the user is fileserveruser.

If the con­nec­tion works, the shared folder will appear. If your user has write access, you can create, open and edit files there. If you plan to use the file server regularly, keep the setup secure: only add users who need access, back up your files regularly and keep per­mis­sions as limited as possible. You now have a working Debian 13 file server that you can expand later.

Reviewer

Go to Main Menu