This physical Ubuntu home server covers my family’s data backup needs in a local private network using Syncthing and custom Bash scripts for system monitoring, and network security policies configuration.
- Sharing of local network files with Samba (Windows <--> Ubuntu <--> Fedora).
- Reverse proxy setup for Syncthing using Nginx.
- Virtual Private Network set up using WireGuard.
- Server ”Wake on LAN” from main computer and smartphone.
- Automated backups using Timeshift and server file logging using Cron jobs.
This project also has a Python app that monitors your system/server that I use with my own. Output is written to a json file and stdout.
It creates snapshots of the state of the system each 30 seconds (configurable):
{"Tasks": {"total": 440, "running": 1, "sleeping": 354, "stopped": 1, "zombie": 0},
"%CPU": {"user": 14.4, "system": 2.2, "idle": 82.7},
"KiB Mem": {"total": 16280636, "free": 335140, "used": 11621308},
"KiB Swap": {"total": 16280636, "free": 335140, "used": 11621308},
"Timestamp": 1624400255}
This Ansible playbook can be used to automatically setup what's shown on this repository. ansible_hs_playbook.yaml
For Wake-on-LAN it's necessary to replace the network_adapter
variable for the actual network adapter name on the ansible playbook and it's also necessary to enable the feature on the BIOS as shown in section 4 of the setup on this repo. This section of the playbook only works on Ubuntu for now due to the fact that the network configuration file is different depending on the Linux distro.
Workflow output | Coverage report |
---|---|
![]() |
![]() |
- Home server should be accessible from the main computer.
ssh <user>@<ip>
-
Install Samba.
sudo apt install samba
-
Make a shared folder.
sudo mkdir /media/myfiles
-
Make main user owner of shared folder.
sudo chown $USER: /media/myfiles
-
Create a user and password for shared folder.
sudo smbpasswd -a <user>
-
Configure folder location in Samba config file at the end of the file.
sudo nano /etc/samba/smb.conf
-
Add shared folder on Windows
-
Shared files ready to use!
- Selected files should be sent automatically to central hard drive each week.
- Selected files should be sent to central hard drive when prompted.
- Network adapter supports Wake-on-LAN
sudo ethtool <network_adapter>
-
Enable Wake-on-LAN
sudo ethtool <network_adapter> | grep "Wake-on"
sudo ethtool -s <network_adapter> wol g
-
Make configuration persistent. For Ubuntu, we have to configure the network adapter on the "netplan" folder:
sudo chmod u+w /etc/netplan/00-installer-config.yaml
nano /etc/netplan/00-installer-config.yaml
-
The user should be able to see which devices are connected to the network.
-
To monitor the local network, you can use the built-in internet service provider tool. To access this tool, search in the back of your home router and search for the modem IP, user and password.
-
To monitor the local network on Windows, install
WakeMeOnLan
. -
To monitor the local network on the server side (Ubuntu), use
ip addr
to discover the server's network adapter -
npmap <ip>/<mask>
-
-
The user should be able to blacklist selected users.
- Use the network provider built-in tool.
- Use the network provider built-in tool.
- System should keep track of files backed up.
-
[5.1] Create a script to log size, date of modification and number of files
-
#!/bin/bash echo "=======================" >> /media/shared_folder_backup.log ls -lh /media/myfiles/ >> /media/shared_folder_backup.log
-
[5.2] Change permissions to execute file
-
sudo chmod +x /custom_scripts/record_shared_files.sh
-
[5.3] Schedule task to execute each day
- Verify if the user has a crontab
crontab -l
- Create or edit said user crontab
crontab -e
- Schedule task to execute every hour
crontab -e
-
- Files should be backed up every day without user input.
- To back up files daily, configure "Recovery" settings.
- To back up files daily, configure "Recovery" settings.