Skip to content

Download / Home Server

Raspberry Pi Home Server Setup Code

Complete command-line code and configuration instructions for setting up a Raspberry Pi home server with network file sharing (Samba). Configure SSD boot, install Samba, and set up shared drives.

Server SetupSambaBy Vilros

Overview

This guide provides all the command-line code for setting up a Raspberry Pi home server with network file sharing. The complete step-by-step tutorial includes SSD setup, Samba installation and configuration, and optional guest access.

What you'll configure:

  • System updates and SSD boot preparation
  • SSD mounting and verification
  • Samba network file sharing server
  • User authentication and permissions
  • Optional guest access for network shares

Step 0: Update & Prepare

Once you are on the Pi desktop and the system is ready for you, click on the Terminal icon. We're going to run one more update just to be certain. Enter the following text exactly as it appears here, then press Return:

sudo apt update && sudo apt full-upgrade

Once that process is finished, you are going to make certain that your system is adequately prepared for running your SSD. Again, enter the following text exactly as it appears here, then press Return:

sudo rpi-eeprom-update

Step 5: Booting from SSD

When you boot up the Pi, you should see your SSD as an icon on your desktop. If you don't, open Terminal and run the following command:

df

This command displays all mounted filesystems and will show your SSD if it's properly mounted.

Step 7: Samba installation and configuration

Samba is a network protocol that allows computers to share storage volumes. We will install it on the server, then configure it.

Update and install Samba

Any time a server is altered, you should update its system software to be certain you are using the latest, most stable version. So, begin by entering this command:

sudo apt update

Then install Samba with this command:

sudo apt install samba samba-common-bin

Configure Samba

Now you will configure Samba:

sudo nano /etc/samba/smb.conf

Scroll down to the very end of the file and add this configuration block:

[SharedDrive]
path = /mnt/shared
browseable = yes
writable = yes
only guest = no
create mask = 0777
directory mask = 0777
public = no
valid users = pi

Important notes:

  • The text at the top, enclosed in [ ] will be the name of the volume that you see on your computer. You can change it to whatever you like here — it doesn't have to be "SharedDrive." But you must remember to use the name you've chosen in later commands, if you change it!

Create Samba user

Now that Samba is installed and configured, you will have to create Samba user authentication:

sudo smbpasswd -a pi

(Again, if you changed the user name to something other than pi, use that instead of pi in the command.)

The system will prompt you to enter a password and then verify it. Do so and write it down for now so that you don't forget it!

Set permissions

The next step is to set permissions for the shared volume:

sudo chmod 777 /mnt/shared

And then:

sudo chown pi:pi /mnt/shared

(Again, if you've changed the user name, be sure to replace pi in the command above. And if your location is not /mnt/shared, be sure to replace it with the correct location.)

Restart and enable Samba

Now that Samba has been properly configured, you need to restart it:

sudo systemctl restart smbd
sudo systemctl restart nmbd

And then set Samba to start automatically when the server boots:

sudo systemctl enable smbd
sudo systemctl enable nmbd

Step 9: Guest access (optional)

You might want other people on your network to have access to the server. Or you might just want to avoid putting in your name and password every time you connect. If so, you can enable guest access, which allows anyone to connect to the server, so long as they have the address.

Enable guest access

Enabling guest access is easy. Once again, we will edit the Samba configuration:

sudo nano /etc/samba/smb.conf

Scroll down and change this line:

only guest = no

to read this instead:

guest ok = yes

Change the line that reads:

public = no

to:

public = yes

Lastly, delete the line that begins:

valid users

Save and close out of the editor, then restart Samba as before:

sudo systemctl restart smbd
sudo systemctl restart nmbd

Now when you connect to the server with the steps from Step 7, you will not have to authenticate — your server will open immediately for you.

Sources

Based on the Home Server setup code from Vilros. Updated October 26, 2026 with complete Samba configuration instructions.