# How to set up a Debian 13 file server

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 sufficient storage space for your data will do.

For a file server, storage capacity and reliability 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 connection will make a noticeable difference. 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.

### What kind of server should you use?

For a **home file server** or a small team setup, a [VPS](https://www.ionos.co.uk/servers/vps "IONOS: VPS") is often enough, especially if your storage needs are modest and only a few users will move large files at the same time. A [dedicated server](https://www.ionos.co.uk/servers/dedicated-servers "IONOS Dedicated Server") or [bare metal server](https://www.ionos.co.uk/servers/bare-metal-servers "Bare Metal Server from IONOS") 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 performance. 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](https://www.ionos.com/digitalguide/server/know-how/proxmox/) make it easier to separate the file server from the rest of the system. For example, a [Proxmox file server](https://www.ionos.com/en-ie/digitalguide/server/configuration/how-to-set-up-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 transcoding**.

## 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](https://www.ionos.com/en-ie/digitalguide/server/know-how/debian-the-universal-system-software/) 13 so you have the latest bug fixes and security patches. Do so using these commands:

```bash
sudo apt update 
sudo apt upgrade -y
```

## 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 components you need to run Debian as a standalone file server. You can install Samba using the following command:

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

After the installation, check if Samba is available:

```bash
smbd --version
```

If the Samba version number appears, the installation was successful.

## 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:

```bash
sudo mkdir -p /srv/fileshare
```

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

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

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 permissions 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 configuration

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

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

Add this section to the end of the file:

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

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 permissions for new files and folders. Samba uses parameters like these as part of the standard `smb.conf` configuration.

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 encryption 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 configuration 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`:

```bash
sudo smbpasswd -a fileserveruser
```

Then enable the Samba account:

```bash
sudo smbpasswd -e fileserveruser
```

## Step 7: Check the configuration and restart Samba

Before you restart Samba, test the configuration. This helps you catch typos or invalid settings in `smb.conf` up front.

```bash
testparm
```

If `testparm` does not report any errors, restart the Samba services. Then enable them so they start automatically when the server boots:

```bash
sudo systemctl restart smbd nmbd 
sudo systemctl enable smbd nmbd
```

Finally, check Samba is running:

```bash
sudo systemctl status smbd
```

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 connection 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 permissions as limited as possible. You now have a working Debian 13 file server that you can expand later.


This is a markdown version of: [https://www.ionos.com/en-ie/digitalguide/server/configuration/debian-13-file-server/](https://www.ionos.com/en-ie/digitalguide/server/configuration/debian-13-file-server/) for AI/LLM consumption.