Network-Attached Storage at 50,000 Feet

networking equipment

Pertinent Steps to Configure a Linux Server to Share Files

In this article I walk quickly through *most* of the steps needed to set up a file server for home sharing for a DIY networked attached storage (NAS). Spoiler alert: it is very basic and uses Samba. Yes, some of you might be thinking I really ought to check out an honest-to-goodness server for NAS such as OpenMediaVault. Yes, I did in fact go that route at first but then opted to do things manually. I am a control freak. There. I said it.

Important: all of the steps in this article assume a local network, you will need to be take additional steps if you plan on exposing your network to the Internet!

Before we Begin

Talk is great and so are helpful articles but before doing any of the subsequent steps you will need a machine on your local network that can be used for file sharing. See my article on MaximusNAS in this regard.

Label your machines where practical to minimize confusion!

For this article, ‘Client’ is the machine on your local network that you use to configure the Server, and ‘Server’ is the machine being configured as your NAS.

Install Ubuntu

There are lots of articles out there on installing Ubuntu so I do not plan on going into a lot of detail here. Did I mention this was supposed to be quick-and-dirty? I have my own list of favourite repos and other goodies that I like to include during a fresh install, perhaps this is the subject for a future article!

Configure SSH

See my article on Get SSH Working on a Raspberry Pi 4. Once SSH is configured, perform an initial test by logging into the Server from the Client.
Try to interact with the Server via SSH from this point onwards.

Option 1 — Build RAID from Scratch

I must admit that this section needs further work! I was lucky in that I already had a RAID from another machine that I brought over to the new Server.

What are your experiences in building RAID from scratch?

One point worth mentioning is that once your RAID is set up, create a filesystem with a unique name. Avoid special characters such as # in the volume name.

Option 2 — Initial Setup of Existing RAID

See this post, this one and this one on how to migrate an existing RAID in Ubuntu with mdadm.

Install the RAID manager via:

sudo apt-get install mdadm

Scan for the old RAID disks via:

sudo mdadm — assemble — scan

Next, update initramfs via:

sudo update-initramfs -u

Identify all drives for this Ubuntu machine:

sudo fdisk -l

There will likely be many drives to choose from! Make a note of specific drive connected to your RAID, identified by physical size as applicable. For this tutorial the desired drive is named:


Make a new directory to serve as the mount point for your RAID:

sudo mkdir -p /media/<server_user>/<drive_name>

Mount the drive to the newly-created mount point:

sudo mount /dev/md123 /media/<server_user>/<drive_name>

Initial Setup of Shared Folder on RAID

Make a single folder on your drive to get the correct permissions for the Server. Navigate to your drive then:

mkdir BUp

Wait until Samba is configured before populating the other shares.

Important: Do not name your shares with special characters such as #. Doing so will make your life miserable, particularly if you plan on using NFS to share your folders. Creating shares with [a-z][A-Z] as well as underscores and numbers [0–9] appears to work fine, provided the first letter is [a-z][A-Z].


Set-up and enable Samba sharing for the newly-mounted drive; see my article on Setting up for Success with Samba for details. Confirm the new Samba share is available from your Client machine.


Interactive SSH is nice but it has limitations. VNC is a good alternative if you need graphical access to your Server. See this super helpful tutorial by DigitalOcean to get you set up with VNC.

I have also built a quick Shell script to help get SSH set-up for secure VNC sessions:

echo ‘’
echo ‘Starting SSH for VNC, open remmina to VNC to toni, use localhost:5901’
echo ‘’

# Start SSH.
ssh -L <port>:<ip>:<port> -C -N -l <server_user> <server_ip>

Finalize Setup of Shared Folders

This part assumes you have an empty set of folders on your Client that you wish to use as shared folders on your Server. With Samba up-and-running and the drive on your Server shared with your Client, proceed with copying the empty folders to the Server. See this post for details. SSH to your Server then run the following commands to copy the permissions from the initial folder we created a few steps ago. Copy its permissions to the other folders:

cd /media/<server_user>/<drive_name>

Important: be sure you are in the correct folder before performing the following steps to ensure you are changing the ownership and group of the correct folders!

chown — reference=BUp *
chgrp — reference=BUp *

If the permissions of your shared folders are set to root, root you will likley get the following error when running a service such as rsync from a different machine to copy and back-up items:

sync: failed to set times on “/destination/.”: Operation not permitted (1)

If this is the case you need to set the ownership and group for your shared folders on the Server:

sudo chown <server_user> /Share_A
sudo chgrp users /Share_A

Repeat these commands for additional shares as appropriate, see this post for details.


This was a very abridged look at how to set up a file server for a home network. I think the term ‘file server’ is probably very generous but I am sticking with it! What are your experiences with setting up servers, particulary for home use?

Courtesy of Thomas Jensen on Unsplash
Liked this post? Take a second to support us on Patreon!

1 thought on “Network-Attached Storage at 50,000 Feet”

  1. Pingback: Go for the Gold with your Disk I/O! –

Leave a Comment

Required fields are marked *