You're welcome! Beige is beautiful, Beige is profitable!
confusedpuppy
Now I'm confused. That means I feel something, yay!
That's actually a combination between "Engage" and the german word "Eingang" and is a very deep metaphor! Thank you for enganging with my content!
If phone bad, why do I still feel nothing after using it? Shouldn't I feel bad? Checkers, mate!
You're welcome, corporate appreciates your feedback!
Thank you for publicly disclosing my private medical records!
Naughty! Thank you for engaging in my ~~public humiliation~~ recycling kink!
You're welcome, the children are our future!
I use rsync for many of the reasons covered in the video. It's widely available and has a long history. To me that feels important because it's had time to become stable and reliable. Using Linux is a hobby for me so my needs are quite low. It's nice to have a tool that just works.
I use it for all my backups and moving my backups to off network locations as well as file/folder transfers on my own network.
I even made my own tool (https://codeberg.org/taters/rTransfer) to simplify all my rsync commands into readable files because rsync commands can get quite long and overwhelming. It's especially useful chaining multiple rsync commands together to run under a single command.
I've tried other backup and syncing programs and I've had bad experiences with all of them. Other backup programs have failed to restore my system. Syncing programs constantly stop working and I got tired of always troubleshooting. Rsync when set up properly has given me a lot less headaches.
I don't have root access on my phone but I still copy backups of my media and apps that export data to accessible files.
I keep my process very simple using Termux with rsync
openssh
and termux-services
packages.
I created a folder dedicated on my for syncing between phone to computer called sync
but you can change this for your needs.
From a fresh Termux install, the setup should look something like the following:
# Update package list and packages
pkg update && pkg upgrade
# Install required packages
pkg install rsync openssh termux-services
# Setup Termux's access to your phone's files
termux-setup-storage
# Make the required folder
mkdir ~/storage/shared/sync/
cd ~/storage/shared/sync/
# Automatically start your SSH server when you open Termux
sv-enable sshd
- Get your phone's username:
~ $ whoami
u0_a205
- Optional: Setup a password with the command
passwd
(I can't remember if this step is important)
A quick note:
Termux on android has a file system quite different than a computer so file and directory names can get quite long. The pwd
command would show /data/data/com.termux/files/home/storage/shared/sync
for my sync folder.
This can be made simpler by using the realpath
command. realpath /data/data/com.termux/files/home/storage/shared/sync
then shows /storage/emulated/0/sync
as a result. If you're using CLI, this may make your commands easier to read.
Now you can start to build your rsync
command to transfer your files.
When setting up an rsync
command, ALWAYS use the --dry-run-
option. This performs a "transfer" without any files being moved.
- From my computer (data transfer direction: Phone -> Computer):
rsync --dry-run --archive --verbose --human-readable --partial --progress --compress -e 'ssh -p 8022' u0_a205@192.168.40.210:/storage/emulated/0/sync/ /home/computer_username/backup/
- From my phone (data transfer direction: Phone -> Computer):
rsync --dry-run --archive --verbose --human-readable --partial --progress --compress /storage/emulated/0/sync/ computer_username@192.168.40.205:/home/computer_username/backup/
Explanation:
--archive
preserves several file attributes--verbose --human-readable --partial --progress
creates a readable output to see what is happening--compress
compresses the data during the actual transfer (good for over a network)-e 'ssh -p 8022'
SSH on termux runs on port 8022u0_a205@192.168.40.210:/storage/emulated/0/sync/
andcomputer_username@192.168.40.205:/home/computer_username/backup/
are howrsync
identifies remote folders. Basic format is @:/path/to/folder//home/computer_username/backup/
and/storage/emulated/0/sync/
are the local folders, relative to what machine thersync
command is being run from.
In order to reverse the direction of a command relative to the machine you are running on, simple swap the remote folder and local folder in the command. Example: From only my computer:
# Direction: Phone -> Computer
rsync --dry-run --archive --verbose --human-readable --partial --progress --compress -e 'ssh -p 8022' u0_a205@192.168.40.210:/storage/emulated/0/sync/ /home/computer_username/backup/
# Direction: Computer -> Phone
rsync --dry-run --archive --verbose --human-readable --partial --progress --compress -e 'ssh -p 8022' /home/computer_username/backup/ u0_a205@192.168.40.210:/storage/emulated/0/sync/
In order to actually transfer files, remove the --dry-run
option from the previous rsync commands. The output in your terminal will show additional information regarding transfer status.
Additionally, you can also add the --delete
option to the rsync
command, this will "deduplicate" files, meaning the source folder will force the destination folder match, file by file. That means deleting any file in the destination folder that does not match the source folder list of files.
A command WITHOUT --dry-run
and WITH --delete
would look like the following (CAUTION: THIS CAN DELETE FILES IF UNTEST):
rsync --delete --archive --verbose --human-readable --partial --progress --compress -e 'ssh -p 8022' u0_a205@192.168.40.210:/storage/emulated/0/sync/ /home/computer_username/backup/
I personally manually transfer my backups into an encrypted external drive which I manually decrypt. /u/emhl@feddit.org has a suggestion for automated encrypted backups if that's more to your needs.
Yeah, a few weeks ago a achieved my state of "secure" for my server. I just happened to notice a dramatic decrease in activity and that's what prompted this question that's been sitting in the back of my mind for weeks now.
I do think it's important to talk about it though because there seems to be a lack of talk about security in general for self hosting. So many guides focus on getting services up and running as fast as possible but don't give security much thought.
I just so happened to have gained an interest for the security aspect of self hosting over hosting actual services. My risks for self hosting is extremely low so I've reached a point of diminishing returns on security but the mind is still curious and wants to know more.
I might write up a guide/walkthrough of my setup in the future but that's low priority. I have some other not self hosting related things I want to focus on first.
Soft caresses of an infinite scroll