Backing up part 2 : Using Linux as a Time Machine backup destination

While Time Machine is an excellent backup solution for macOS, external drives aren’t always the most convenient option, especially if (like me) you already have a Linux server with plenty of storage. By configuring Samba on your Linux server, you can use it as a network Time Machine destination, allowing automatic wireless backups without needing to plug in an external drive. Here’s how I set mine up (I used Ubuntu, but have put in commands for other distros as well).

On Linux

1. Install Samba on the Linux Server

# Ubuntu/Debian
sudo apt update
sudo apt install samba avahi-daemon

# RHEL/CentOS/Fedora
sudo dnf install samba avahi

2. Create a Directory for Time Machine Backups

sudo mkdir -p /mnt/timemachine
sudo chown your_username:your_username /mnt/timemachine
sudo chmod 755 /mnt/timemachine

3. Configure Samba

Edit the Samba configuration file:

sudo nano /etc/samba/smb.conf

Add this configuration at the end:

[TimeMachine]
   comment = Time Machine Backup
   path = /mnt/timemachine
   browseable = yes
   writable = yes
   valid users = your_username
   create mask = 0600
   directory mask = 0700
   spotlight = yes
   vfs objects = catia fruit streams_xattr
   fruit:aapl = yes
   fruit:time machine = yes

4. Set Up Samba User Password

sudo smbpasswd -a your_username

5. Restart Samba and Avahi

# Ubuntu/Debian
sudo systemctl restart smbd nmbd avahi-daemon
sudo systemctl enable smbd nmbd avahi-daemon

# RHEL/CentOS/Fedora
sudo systemctl restart smb nmb avahi-daemon
sudo systemctl enable smb nmb avahi-daemon

6. Configure Firewall (if needed)

# Ubuntu/Debian with ufw
sudo ufw allow samba

# RHEL/CentOS/Fedora with firewalld
sudo firewall-cmd --permanent --add-service=samba
sudo firewall-cmd --reload

On the Mac

1. Connect to the Share

Open Finder and press Cmd + K, then enter:

smb://server_ip_or_hostname/TimeMachine

Enter your username and password when prompted.

2. Enable Time Machine to Use Network Drives

If the share doesn’t appear in Time Machine preferences, you may need to enable unsupported volumes:

sudo tmutil setdestination /Volumes/TimeMachine

Or directly set it:

sudo tmutil setdestination smb://username@server_ip/TimeMachine

3. Configure Time Machine

  1. Open System Settings → General → Time Machine
  2. Click the + button to add a backup disk
  3. Select your network share
  4. Start the backup

Tips and Considerations

  • Space Requirements: Ensure you have enough space on the Linux server (Time Machine typically uses 1-2x your Mac’s storage)
  • Performance: Network backups are slower than local ones, especially for the initial backup
  • Reliability: Use a wired connection for the first backup if possible
  • Size Limits: You can set a quota using Samba or filesystem quotas to prevent Time Machine from using all available space

Optional: Set a Size Limit for Time Machine

On your Mac, create a sparse bundle with a maximum size:

sudo tmutil setdestination /Volumes/TimeMachine
hdiutil create -size 500g -type SPARSEBUNDLE -fs "HFS+J" \
  -volname "Time Machine Backups" \
  ~/Desktop/TimeMachine.sparsebundle

Then move this to your network share and use it as the backup destination.

Backing up part 1 : Using SSH and rsync

I’m currently using a Mac as my main computer, but also have a Linux machine that I use for heavy lifting, but also for backups. Setting up SSH key-based authentication allows rsync to work seamlessly without password prompts, making backing up and file synchronisation much more convenient. This is particularly useful for automated scripts and frequent manual transfers. It’s what I use to ensure that I have a second copy of every file I download, and to keep my music collection in sync, and helps maintain that illusion that all my computers are actually one computer.

Configuration

1. Generate SSH Key on Mac (if you don’t have one)

First, check if you already have an SSH key:

ls -la ~/.ssh/id_*.pub

If you don’t have a key, generate one:

ssh-keygen -t ed25519 -C "your_email@example.com"

Press Enter to accept the default file location, and optionally set a passphrase (leave empty for truly passwordless, or use ssh-agent for security with convenience).

2. Copy Your Public Key to the Linux Server

Use ssh-copy-id to copy your public key to the server:

ssh-copy-id username@server_hostname_or_ip

You’ll need to enter your password one last time. This command copies your public key to ~/.ssh/authorized_keys on the server.

Alternative method (if ssh-copy-id isn’t available):

cat ~/.ssh/id_ed25519.pub | ssh username@server "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

3. Test the Connection

Try connecting via SSH without a password:

ssh username@server_hostname_or_ip

If it works without asking for a password, you’re all set.

4. Use rsync

Now you can use rsync without password prompts:

# Example: sync a local directory to remote server
rsync -avz /path/to/local/directory/ username@server:/path/to/remote/directory/

# Example: sync from remote server to local
rsync -avz username@server:/path/to/remote/directory/ /path/to/local/directory/

Common Options for rsync

  • -a : archive mode (preserves permissions, timestamps, etc.)
  • -v : verbose output
  • -z : compress data during transfer
  • -h : human-readable output
  • --delete : delete files in destination that don’t exist in source
  • --exclude='pattern' : exclude files matching pattern
  • -n or --dry-run : show what would be transferred without actually doing it

Troubleshooting

If you still get password prompts:

  1. Check permissions on the server:chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
  2. Verify SSH config allows key authentication (on server): Check sshd_config for:PubkeyAuthentication yes
  3. Check SELinux (if applicable on server):restorecon -R -v ~/.ssh

Patterns I have noticed when people struggle with switching to using Linux as their main operating system

A while ago I wrote the following in a blog post that was mainly about Reddit:

I’m in no way surprised that people are generally quite bad at describing the issues they are having, and also that they are very bad at choosing the right place to ask for help. I do have vague intentions to write up long answers to things that people seem to struggle with, probably starting with my insights on how people switching to Linux invariably start off with doing something really hard as part of their initial switch (dual-boot, Nvidia drivers, getting Windows software to work in the same way it does on Windows) and give up soon afterwards, not realising that everything else they will ever do isn’t going to be that hard to set up. That’s an essay for another day, but this is definitely a statement of intent.

This is a start at writing up some of those thoughts.

2025 marks my 20 year anniversary of starting to use Linux as a desktop operating system. Over those years I’ve used it consistently, and used it as my primary operating system for most of that time. I still use Windows at work, but when I have a choice of what to use then it’s generally Linux (either Debian or Ubuntu, depending on the use case). Because I’m an experienced user, and also someone who has worked in IT support, I often find myself trying to help people who want to make the same switch I did, but I find myself failing at the first hurdle because they are either trying to do something that is hard, or something I’ve never actually done myself.

Things people often ask for help with

I thought it was worth listing those things, because they are all things that I am definitely not the best person to help with, but some of them should be quite trivial with the right instructions:

  • Dual booting Linux and Windows
  • Installing Linux on a PC with an Nvidia graphics card, and choosing a distribution that doesn’t have a GUI for configuring graphics drivers
  • Playing games where no native Linux version exists, or where anti-cheat is a feature of the game
  • Having a workflow that relies on software that is not available for Linux, such as Microsoft Office or Adobe Creative Cloud
  • Using Wine or something similar to run Windows/Mac software on Linux
  • Using a DisplayLink docking station
  • Installing or virtualising Linux on Apple Silicon

Some of these are clearly a result of situations where people want to run Linux as their primary OS, but need to keep Windows or MacOS around for specific use cases. How I always approach this is to have two computers, because my need for Windows is 100% work-related, and I am provided with a computer by my employer. But it would be a different story if I was a gamer or needed to use Photoshop.

I always try and recommend a dedicated Linux computer, because it’s possible to get a great experience on a fairly low-specification machine. Most mini-PCs work well, and there are always refurbished ThinkPads on the market that are either certified to work, or have been used by enough Linux users that documentation will exist for any workarounds required. A second computer reduces the risk of overwriting a bootloader or losing valuable data, and it means that the original computer is still available for those tasks better suited to Windows or MacOS.

But computers are expensive, and for some people they are unaffordable. Which is why a lot of these risky scenarios are attempted in the first place. Computers also consume electricity, produce extra carbon, and take up additional space at home. There are all sorts of reasons why most people only have one computer, and I accept that my default solution to most of these problems is written from a position of privilege.

Pre-switching checklist

Before even thinking about switching, there are a few things I would recommend:

  • Work out what applications you are going to use for everything you use a computer for, and if they are cross-platform then install and use them on your existing OS.
  • Ensure that all data you care about is stored somewhere that is not connected to the PC you plan on installing Linux on.
  • Get used to the Linux command line by installing something like Multipass or WSL.
  • Download the .iso of whichever Linux distro you have chosen, and run it in VirtualBox to check it meets your needs.
  • Burn the .iso file to a USB device, and boot the PC you are going to install Linux on. Check that all your hardware works, and that you are happy enough with how your computer is going to work afterwards.
  • Read and bookmark (or print out) installation instructions, and URLs of sites where you can ask for help or report bugs.

All of these steps are non-destructive. You may at some point realise that you can achieve what you want using a container or VM, or decide that Linux is not for you. These are things that are best found out before you have reformatted the hard drive of your only computer.

But what if it all goes wrong?

Each Linux distribution will have a place where you can ask for help, and where you can access documentation. These should be the first place you look. Reddit is used a lot for support, but there is no guarantee that there will be someone who can answer your question or help you out, and a lot of subreddits are specifically not for support, so if you ask support questions your post will likely be removed, or at best downvoted.

Writing a good description of what is going wrong is essential. I’ve linked to this article for a long time, but I still think it’s the best description of how to write a good bug report. There is also an Ubuntu specific guide that might be useful.

I still try and help people out when I can, but as a non-gamer with fairly modest hardware requirements, I increasingly find that the problems people are having are not things I have any experience with. But I still think there are very few new problems out there, so hopefully there will always be someone who can point new users in the right direction.

Updated Ubuntu Installation script

I’ve made some major changes to my Ubuntu installation script over the last few weeks. Mostly because I finally replaced the hard drive in my laptop and needed to do a clean installation, but also because I wanted to try and get DisplayLink drivers installed by default, which has historically been a pain.

for the latter I’m now using a lot of someone else’s work, and a little bit of my own:

install_displaylink() {
    git clone https://github.com/AdnanHodzic/displaylink-debian.git
    cd displaylink-debian
    sudo ./displaylink-debian.sh
    wget -q https://raw.githubusercontent.com/teknostatik/debian/master/20-displaylink.conf -O /etc/X11/xorg.conf.d/20-displaylink.conf
    cd ..
}

One day there will be a more elegant solution, but for now this will do.

Since writing the original draft of this post I decided that having these drivers on all my computers really isn’t required, and I would generally just plug a HDMI cable in and use the dock for just the standard I/O. But it’s still there in a script as an optional setting, in case anyone else might find it useful. I’ve also added a few more optional settings, for QMK installation and enabling the firewall by default. I tested all this on a clean install of both 24.04 and 24.10 and it all seems to work fine.

Living through history – thoughts on the XZ vulnerability

I have been following the XZ backdoor vulnerability story with interest. Not just because I use Linux and therefore it affects the technology I rely on, but also because I’m interested in the people and processes that underpin open source software, and software development in general.

Linux has relied on volunteer contributions from the start, and in general that fosters a collective sense of responsibility for delivering a great product that meets the needs of the people who use it. But there is also a risk that there won’t be sufficiently skilled volunteers to do what needs to be done, or that the expectations of users cannot be reasonably delivered by volunteers who are likely to also be juggling a paid job and family responsibilities.

This issue has highlighted those risks, but also been a great example of a community coming together to quickly fix an issue in a way a commercial organisation probably never would. By working in public, being transparent, and delivering value quickly, the community has proved that this development and support model can work, but also that there are lessons we can learn about culture, contributor burn out, and how we can continue to release value at pace whilst at the same time maintaining the integrity of the product.

I don’t have answers, but it’s good to see people pulling together, and I do think we’re probably living through history right now.

I also think the standard is being set for documentation related to this kind of issue. These are the pages I’ve bookmarked in relation to this, either to keep up to speed with developments, or to highlight what good practice looks like when it comes to being curious enough to shine a light on things that don’t look right:

Ubuntu 23.10

I upgraded to Ubuntu 23.10 on my laptop last night. It took less than 20 minutes, and so far everything has just worked.

This is the kind of user experience I want on all my devices, and also the kind of experience I strive to deliver to others.

My NixOS Experiments

I have been experimenting with NixOS for a few weeks, and whilst I’m not ready to run it on my main machine, I think I could if I had to. These notes are all the things I had to search, or experiment with, and are largely here for my reference, although if they help someone else then that is great.

Snippets from my configuration.nix file

# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
# services.xserver.desktopManager.gnome.enable = true;

# Enable i3
services.xserver.windowManager.i3.enable = true;

# Configure keymap in X11
services.xserver = {
  layout = "gb";
  xkbVariant = "";
};

# Configure console keymap
console.keyMap = "uk";

# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
  enable = true;
  alsa.enable = true;
  alsa.support32Bit = true;
  pulse.enable = true;
  # If you want to use JACK applications, uncomment this
  #jack.enable = true;

  # use the example session manager (no others are packaged yet so this is enabled by default,
  # no need to redefine it in your config for now)
  #media-session.enable = true;
};

# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
};

# Allow unfree packages
nixpkgs.config.allowUnfree = true;

# Allow QMK to write to keyboards

hardware.keyboard.qmk.enable = true;

# needed for store VS Code auth token 
services.gnome.gnome-keyring.enable = true;

# List packages installed in system profile. 
environment.systemPackages = with pkgs; [
git
featherpad
pandoc
dropbox
dmenu
feh
i3lock
kitty
i3blocks
arandr 
scrot 
xautolock 
barrier
imagemagick
neofetch
zathura
pcmanfm
htop
blueman
cowsay
fortune
shellcheck
abiword
rhythmbox
brasero
sound-juicer
transmission
byobu
tmux
screen
qmk
networkmanagerapplet
protonvpn-gui
protonvpn-cli
protonmail-bridge
unixbench
zerotierone
zoom-us
caffeine-ng
copyq
vscode
];

A script to automate changes

#!/bin/sh
# Standard error mitigation
set -euo pipefail
# Replace existing config
cd /etc/nixos/
sudo mv configuration.nix configuration.nix.old
# download new config
sudo wget https://raw.githubusercontent.com/teknostatik/nixos/master/configuration.nix
# Test
sudo nixos-rebuild test
# Deploy
sudo nixos-rebuild switch --upgrade
# Clean up and then go home
nix-collect-garbage -d
cd $HOME 

Making DVDs from video files

Recently I found myself needing to make a DVD from a recorded stream (of a family funeral that my Mum couldn’t attend because of covid). This is not a task I normally do, and I thought it was worth writing up how I did it in case I ever need to do it again.

Most of these instructions were put together using this wiki page, and assume you are using Ubuntu or some other Debian derivative.

Dependencies

  • ffmpeg
  • dvdauthor
  • mkisofs
  • k3b

The command line stuff

ffmpeg -i video_file_name.mkv -aspect 16:9 -target pal-dvd  -b 1800000 dvd.mpg
dvdauthor -o dvd/ -t dvd.mpg
export VIDEO_FORMAT=PAL
dvdauthor -o dvd/ -T
mkisofs -dvd-video -o dvd.iso dvd/

The GUI stuff

Take dvd.iso and burn it to DVD using K3B (or your burning software of choice – I really should investigate doing this on the command line next time).

Testing

Put the DVD into a normal DVD player and check it plays. The video should load automatically with no menus.

This worked for me. Hopefully if I have to do it again it will be in better circumstances.

Debconf21

I’ve managed to attend a lot of the talks at Debconf21. This was also true of Debconf20, but I very much feel like I’ve understood a lot more of what is being talked about this time, and I’m also very happy that I was sent a conference T-shirt and badge so I can participate fully in the experience.

Talks I’ve attended (with hyperlinks to the video of the talk if they currently exist) are:

Videos of all the talks I missed are also available so there is plenty for me to watch during my long holiday-at-home that starts in less than a week.

It’s interesting to see the different presentation styles as well as the content they are delivering, and I hope I’ve also learned a bit more about what works and what doesn’t when presenting content to a virtual audience.

I’m not sure I would attend a physical Debconf unless I was a little more involved with the project, but I’ve certainly enjoyed doing it virtually this year.

Reddit, IT support, and home offices

I used Reddit quite a bit around a decade ago. Mostly for keeping up to date with Linux and other computer-related things, but also to understand the kind of things people were generally interested in and talking about (became small talk is a thing, and I’m terrible at it). I drifted away a few year ago, but since the first lockdown started I’ve found it a useful source of information about things I’m interested in.

This started when I was researching computer parts for my new desktop PC. I’ve not built a desktop for a long time, so I wanted to see what other people were doing, and how the parts shortage was going to affect the choices I made. I have my PC now, and I’m very pleased with it, but I also didn’t stop using Reddit at that point; I just stopped caring about PC hardware and tapped into the community expertise around my other current hobbies (customising the i3 window manager, Linux in general, mechanical keyboards, cycling, music). It’s interesting to see how other people are customising their computers and their keyboards, and it gives me ideas for changes I want to make to my own setup.

The time I’ve spent on Reddit has also reminded me of how much it’s used as a general support forum for all sorts of things. I try not to get too involved in that side of it, but I am very interested in the way people ask for help with their IT issues and it gives me some useful data to reflect on when I’m thinking about these things as part of my day job.

I’m in no way surprised that people are generally quite bad at describing the issues they are having, and also that they are very bad at choosing the right place to ask for help. I do have vague intentions to write up long answers to things that people seem to struggle with, probably starting with my insights on how people switching to Linux invariably start off with doing something really hard as part of their initial switch (dual-boot, Nvidia drivers, getting Windows software to work in the same way it does on Windows) and give up soon afterwards, not realising that everything else they will ever do isn’t going to be that hard to set up. That’s an essay for another day, but this is definitely a statement of intent.

I’m also starting to get quite interested in the way people have their home offices set up. After 18 months of mostly remote working, I’ll be returning part-time to the office next week, but am still very interested in seeing how other people set their home offices up for maximum productivity. I’ve made a lot of changes since the start of last year, and I suspect many other people have as well. I have intentions to make a long list of people who have inspired me with their setups, but that’s also a job for another day.