Gadgets Updated

Turn a spare laptop into a home file server

An old laptop already has a screen, a battery that rides out power cuts and a quiet processor. It makes a fine private file server.

· Tested on 3 laptops · 3 min read

Difficulty
Advanced
Time
60 minutes
Steps
7 steps
You’ll need
A spare laptop with a working battery
An old laptop closed and running on a shelf with a small green light.

We set up three servers from laptops that were between five and nine years old. All three ran for more than a month without a restart, used about 8 W when idle and shared files at the full speed of the wired network.

A spare laptop that is five or ten years old is still more than enough to share files and photos at home. This guide sets up a simple server that is reachable only from inside your house.

Prepare the laptop

Take out the battery’s reliance on mains by checking its health first. A very swollen or worn battery in a machine that is always on is a risk: if the case looks bulged, remove the battery and run the laptop on mains only.

Wipe it and install a current, supported server operating system. Choose the minimal option without a desktop. Name it something short, such as “attic”. Connect it with a cable if you can: a server on Wi-Fi is a server that drops.

Give it a fixed address

In your router, add a fixed address for the laptop, for example 192.168.1.30. The server and every other device will now always find it in the same place.

Make the lid behave

Set the laptop to stay on when the lid is closed and to turn the screen off. If your system uses a settings file, a line like the following does it:

HandleLidSwitch=ignore

Install the file sharing service

Use short, simple names for shared folders and keep them in one place. A structure with one folder per person and one called “Family” is easier to back up and to explain than a deep tree.

Install the file sharing package from your system’s repositories, create a folder for the shared files and add a user for each person at home. Give each user its own password, and do not reuse the one from your email.

sudo mkdir -p /srv/share
sudo adduser --disabled-login family
ssh [email protected]

Share the folder

Configure the share so that it is writable by your household and not readable by guests. Test from another computer by connecting to the address and creating a file.

Test before you trust it

Copy 1 GB of photos in and out and compare them. A slow or interrupted copy tells you about the cable.

Lock it down

Check once a month that updates are being installed. A quick look at the list of recently installed packages tells you more than any dashboard.

Turn off any service you do not use. Enable automatic security updates and a firewall that only allows your home network to talk to the server. Never forward a port from the router to this machine.

Do not expose it to the internet

A file server open to the world is found within hours by automated scanners. If you need access away from home, use a proper private tunnel instead.

Back it up

A server is not a backup. Plug in an external drive and copy the shared folder every night:

rsync -a --delete /srv/share/ /mnt/backup/share/

Add the command to a scheduled job, and look at the result once a week. For a safe set-up of the router, lock down your router settings first.

Did this guide work for you?

44 people said it worked

Comments

Write a comment