Here is a detailed to set up encrypted, compressed, automated weekly backups from a Windows PC to your Ubuntu server using Restic over SFTP β just like we did with your Parrot OS system.
- Only specific folders backed up (you choose)
- Encrypted and compressed backups using Restic
- Secure transfer over SSH (SFTP)
- Automatic weekly backups (using Task Scheduler)
- Easy restore process
-
Download the latest Restic release: π https://restic.net/
-
Extract the
restic.exe
file into a folder like:C:\Program Files\Restic\
-
Add Restic to the system
PATH
:-
Press
Win + R
, typesysdm.cpl
-
Go to Advanced > Environment Variables
-
Under System Variables, edit
Path
, add:C:\Program Files\Restic\
-
-
Open a new Command Prompt and test:
restic version
β If it prints the version, Restic is installed.
Youβll need an SSH key pair for passwordless access.
Check:
where ssh
If not installed:
- Go to Settings > Apps > Optional Features > Add a feature
- Add OpenSSH Client
In PowerShell:
ssh-keygen -t ed25519
Press Enter to accept the default path and no passphrase.
This creates:
- Public key:
C:\Users\<YourUsername>\.ssh\id_ed25519.pub
- Private key:
C:\Users\<YourUsername>\.ssh\id_ed25519
Use PowerShell:
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh backupuser@<server_ip> "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Test SSH connection:
ssh backupuser@<server_ip>
β You should be logged in without a password.
Set environment variables temporarily in Command Prompt:
set RESTIC_REPOSITORY=sftp:backupuser@<server_ip>:/srv/backups/windows-pc
set RESTIC_PASSWORD=YourStrongPassword
restic init
β If successful, it says:
"created restic repository..."
Create a file:
C:\Users\<YourUsername>\restic-backup.bat
@echo off
setlocal
REM === Configuration ===
set RESTIC_REPOSITORY=sftp:backupuser@<server_ip>:/srv/backups/windows-pc
set RESTIC_PASSWORD=YourStrongPassword
set RESTIC_EXCLUDES=%USERPROFILE%\restic-exclude.txt
REM === Run Backup ===
restic backup ^
"C:\Users\<YourUsername>\Documents" ^
"C:\Users\<YourUsername>\Pictures" ^
--exclude-file "%RESTIC_EXCLUDES%"
REM === Forget old backups ===
restic forget --keep-weekly 4 --prune
endlocal
β Change paths as needed.
Create:
C:\Users\<YourUsername>\restic-exclude.txt
Example content:
*.mp4
*.iso
C:\Users\<YourUsername>\Downloads
Double-click restic-backup.bat
or run it in cmd
.
You should see:
- Files backed up
- Snapshots created
- Old ones pruned
β Backup complete!
-
Open Task Scheduler
-
Create Task
-
General:
- Name:
Weekly Restic Backup
- Run whether user is logged in or not
- Run with highest privileges
- Name:
-
-
Trigger:
- New β Weekly β Monday β 3:00 AM
-
Action:
- Program/script:
C:\Users\<YourUsername>\restic-backup.bat
- Program/script:
-
Save and enter your Windows password when prompted.
β Now Restic will run automatically each week.
To see backups:
restic snapshots
To restore:
restic restore latest --target C:\RestoredFiles
You now have automated, encrypted, incremental, compressed backups from Windows to Ubuntu, using only:
- Restic
- SSH
- Task Scheduler