Introduction
It is time to get the file server up and running. Since every other server in this Mini PC rebuild depends on shared storage, it is priority one. Its time to hit that keyboard!
In earlier videos, I explained the reasoning behind this Proxmox server rebuild and prepared the Debian base system I’ll be using for most of the VMs (virtual machines) in this setup. I’ll link those videos at the end for anyone who wants the background.
In this article, I’ll build a virtual file server that can be accessed over SMB (Server Message Block), a standard Windows protocol that is supported on most devices. Because I deal with a mix of Windows, macOS, Linux, and Android/I-phones I’m avoiding NFS, which can be hit-or-miss outside the Linux/Unix world.
Eventually, I also want to add a simple web interface for mobile-friendly access. But for now SMB is the focus. In this video, I’ll cover:
- Converting the Debian base VM to a template
- Cloning the Template
- Expanding the Clones virtual disk
- Assign the VM new machine-ID, static IP Address, Host-name, and SSH keys
- Adding/mounting a new partitioning
- Installing and configuring Samba
- Testing the connection from another computer
A quick note before we begin: this server lives on my private LAN, not directly exposed to any public networks. The inital security model in this presentation is very lax, and will be upgraded later. I’ve learned, the hard way, that to avoid headaches it’s better to start with a simpler working baseline and then tightening security in small controlled steps. If something breaks, you know what caused it and a fix is easier to figure out and manage.
Base Debian VM to Template
This part is pretty straightforward. I’m starting with the Debian base VM from the previous video and converting it into a Proxmox template.
Once a VM has been converted into a template, it can no longer be started or used as a normal VM. Instead, it becomes a read-only source for creating future clones.
- In Proxmox select the Debian base VM
- Make sure it is stopped.
- Right click on the VM and select “Convert to Template”.
- Confirm the operation by selecting Yes
The icon will change to indicate that the VM is now a template.
Proxmox also supports a cloud-init process, which can automate some of the required configuration we will be doing when cloning a new VM. It looks useful, but I’ve encountered a few issues while learning it. It should work well if configured correctly, but for this build I’ll be making changes manually.
Template to VM Clone
Next I will create a new VM from the template.
- Right-click the template just created and select Clone
- Enter a new ID and name for the VM **Important**
- Select Full Clone as the clone mode
- Wait for the cloning process to complete, it should take less than a minute
Proxmox should change the MAC address automatically, but it’s worth verifying. In Proxmox, select the new VM and go to
Hardware → Network Devices
Do the same with the template, and compare the two MAC addresses to make sure they are different
Expand Cloned VM Storage
Because this VM will be the file server, we need a place tom put the files. Terefore I need to increase its storage capacity.
- Select the new VM
- Go to the Hardware section and select the Virtual Drive
- Select the Disk Action button, and then Resize from the drop down menu.
- Enter how much to increase the size in GiB
- Selected Resize Disk and wait for the operation to finish
For this FILE server I am expanding the drive to 2.3 TB. Be aware that the OS (Operating System) needs to recognize the new space, partition it, format it, and mount it before Samba can use it.
First Run, Turning Clone to Stand alone VM
I could connect over ssh (Secure Shell) immediately, but I want to make several changes via the Proxmox console first. The VM inherited its configuration from the template. Some of which needs to change preventing multiple VMs from the same template interfering with each over. These changes affect the VM’s identity, SSH configuration, and networking. Some of which will temperately break ssh.
I’ll log in as root for this initial setup, as some of these changes can also affect existing non root user accounts.
Increase Console Font Size: The default console font is difficult for me to read, so I’ll increase its size. This change only lasts until the next reboot.
setfont Lat15-Terminus28x14
Change machine-id: The current machine-id is from the template. Each VM should have its own unique machine-id. To change this I need to do four things.
1. Stop the the controlling service
systemctl stop systemd-machine-id-commit
2. Remove the existing machine-id form two places
rm -f /etc/machine-id /var/lib/dbus/machine-id
3. Generate a new machine-id
systemd-machine-id-setup
4. Restart the service
systemctl start systemd-machine-id-commit
Change ssh Host Keys: The cloned VM also inherited the SSH host keys from the template. If those keys are identical across multiple machines, SSH clients may display warnings and have difficulty connecting. Debian stores the SSH keys in /etc/ssh. There are four steps to changing them.
1. Stop the ssh service
systemctl stop ssh
2. Delete exsisting ssh keys
rm -f /etc/ssh/ssh_host*
3. Generate new ssh keys
dpkg-reconfigure openssh-server
4. Restart the SSH service
systemctl start ssh
Network Configuration: The VM also needs its own hostname and network configuration. By default a base Debian install should be running networking.service. This can be checked with the following command.
systemctl status networking.service
Host Name, Domain, and static IP address are stored in three files which need to be edited, changing the template provided information for the correct VM information. Use your favorite console based text editor.
/etc/network/interfaces
/etc/hosts
/etc/hostname
At this point restart the network.
systemctl restart netorking.service
Also, test whether the DNS service is working with the following command. This should return a IP address.
getent hosts debian.org
Update Partitions: To expand the drive storage, I need to identity the drive. There is only one drive in the template, so I know what it is. But to be on the safe side run the following command to identify all block devices. Because I used the template, it shows /dev/sda. If you are following along but not using the template, you may see different drives listed.
lsblk
Once I know the drive designation I can run fdisk (or cfdisk for a more intuitive interface). Again if following along and using the template there should be three drives; sda1 EFI, sda2 Swap, and sda3 System. All added space will be at the end after sda3. If you are not using the template, you will need to do some interpretation. I create a new partition filling up the unused space, labeled Data.
fdisk /dev/sda or cfdisk /dev/sda
I want to format this new partition with the ext4 file system.
mkfs -t ext4 /dev/sda4
I want to note, in case anyone asks, that I do not need to create /srv. This directory already exists and is empty in a base Debian install.
Finally I want to update the fstab file. But first I need the UUID for the new partition.
blkid
Copy the UUID for sda4 to use in the /etc/fstab file. Below is the entry for my system, which goes below all other entries. Also consider adding a comment about the entry. This should be consistent across any Debian VM base build. But double check to be sure.
/etc/fstab
UUID=your-drive-uuid /srv ext4 defaults 0 0
At this point the VM should be fully standalone. Reboot it!
Install Samba
Once the VM has come back up, log in via ssh. It is time to install and configure samba. Use the following commands to install samba (remember we are logged in via ssh and not root).
sudo apt update
sudo apt install samba
Now that Samba is installed we need to check that it is active, will start on reboot, and is running without errors. Use this command.
sudo systemctl status smbd
Lets do a few additional checks before moving on. Check the location of the smb.conf file;
ls /etc/samba
I also want to check the drive size seen by the operating system to validate the expansion;
lsblk
In this initial install I will focus on a shared folder and user home folders. I will add additional folders as I bring other servers on line. The folder I need to create is the public share, and I need to initially be the owner of the folder. I will be storing data in the /srv partition. Use the following commands.
sudo mkdir /srv/public
sudo chown -R rt:rt /srv/public
ls -la /srv
I want to keep the original smb.conf file, so I will move it.
ls -la /etc/samba
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
ls -la /etc/samba
Then I will create a new very basic smb.conf file to get things up and running. Remember the security at this point is basically nonexistent. Once I have things up and running I will update security one item at a time. The smb.conf file I am creating here is about as simple as it gets. It is short and should be self explanatory. One of the reasons for keeping it simple. When I start adding layers of security, things will get complicated and less clear fairy fast.
sudo nano /etc/samba/smb.conf
[global]
workgroup = Albatros
security = user
server string = Isis
server role = standalone server
unix charset = UTF-8
[homes]
comment = User Home Directories
browseable = no
read only = no
valid users = %S
[public]
comment = Shared directory for everyone
path = /srv/public
browseable = yes
read only = no
guest ok = yes
Once complete, we can validate the new smb.conf file.
testparm
Finally we need to give the non root user a samba password.
smbpasswd -a rt
And we are finished. The last thing to do is restart the server and validate that everything is working.
Validate the Install
I want to validate that I can reach the shares from a different computer. Note that Windows should already be setup for smb. On Linux you will want to make sure that the cifs-utils package is loaded. Fire up the File browser and point it towards the File Server. You will need to specify samba. I am using the KDE Dolphin file browser. But this should work with most modern file browsers available in Linux.
smb://172.20.30.63
Conclusions
The focus of this article has been on getting the file server up and running. A lot of the samba configuration stuff, I am asking to take on faith, as it can rapidly spiral. Once I get through the other servers, I will revisit the file server and focus specifically on securing samba.
The point of this article was to get the file server up and running, and not do a deep dive into various security configurations.
You may also want to take the time to review some of the other articles in this series.



Leave a Reply