Android
One of the big benefits of an Android phone compared to an iPhone is that you can treat it like a Linux server. And that’s exactly how I want to leverage Android’s capabilities. With Termux.
The initial reason for doing this was to transfer my music from iTunes on my PC over to my Android phone. I did this successfully. Since a large number of files on iTunes are m4a files, I use VLC on Android to play all this music.
Termux
Since I’m fairly comfortable with Linux’ capabilities, I was looking for a way to enable this on my newly purchased Android OnePlus 8 Pro which I bought on Tue, 20 Oct 2020. Yeah, I decided to ditch my iPhone Xs Max after it had a thin screen bleed running down the right side of the phone. It was just about 1.5 years since I bought it and I was just fed up with paying so much for a device that, despite me taking care of it, wasn’t something that was built to last.
Termux provides Debian capabilities on your android phone. And my favourite Linux distribution is Debian, because it is a free stable Linux distribution without commercial influences. I started using Linux since my university days at Wollongong from 1998.
Initial Setup
Here are the steps to install Termux on your Android phone:
Download and install Termux from the Google Playstore.
By default, Termux does not provide access to your file storage.
Launch Termux on your phone and execute
$ termux-setup-storage
to enable access to Android’s file storage.Next, I want to access my phone from my laptop. So I install OpenSSH server.
SSHD Install
Reference URL: https://wiki.termux.com/wiki/Remote_Access
$ pkg upgrade
followed by$ pkg install -y openssh
The public private key pair is stored in /data/data/com.termux/files/usr/etc/ssh/ssh_host_ed25519_key ssh_host_ed25519_key.pub
`` $ cat $PREFIX/etc/ssh/sshd_config`` to ensure password authentication is enabled.
$ passwd
to set your password$ ip a show
to show your phone’s IP address.$ sshd
to start the OpenSSH serverOn your PC or ssh client,
$ ssh -p 8022 <ip_address of phone>
to login to your phone.
rsync
$ apt update
followed by$ apt install -y rsync
to install rsync on your phone.On your laptop, issue
$ rsync -av -e 'ssh -p 8022' --progress * <phone_ip_address>:~/storage/music/