12th March 2020

ssh and rsync for Android, Termux

I used SSHelper for some time to rsync my files from my Linux machine to Android phones, see here. I most notably used this for transfering photos. I now use Termux. I prefer Termux over SSHelper as it allows to install new programs within Termux using pkg oder apt-get.

Starting Termux looks like this:

For transfering files from PC to phone I start sshd from package openssh on phone:

sshd -p2223

For transfering files from phone to PC I just scp. To quickly start or stop sshd I use some aliases, e.g.,:

alias s='sshd -p2223'
alias sk='pkill sshd'
alias sn='ssh klm@N'

So I just type s to start sshd, I type sk to stop the sshd-daemon, and so on. Needless to say that when you offer some network service, like sshd, you must instruct your router to provide proper port forwarding so that PCs, which are usually using LAN, can then access WLAN services, which are usually in another subnet. Also you should set fixed IP addresses for this particular phone.

There is one catch one has to be aware of: One needs to activate file access! This file access activation is required for example to access photos, which are usually stored here

/mnt/sdcard/DCIM/Camera

Screenshots are usually stored here:

/mnt/sdcard/Pictures/Screenshots

There is a Wiki for Termux here. Termux was written by Fredrik Fornwall.