- Propietary app: https://play.google.com/store/apps/details?id=com.medhaapps.wififtpserver
- Open source app: https://ppareit.github.io/swiftp/
Termux in a powerful app to run a Linux environment, making possible your Android phone has some applications or tools like a desktop computer. So you could backup your phone content seamlessly without any propietary cloud. You can use the embedded ssh server running at 8022 port.
Install ssh server is easy in Termux: pkg install openssh
Edit your ~/.ssh/config
to config the Android phone IP address. For example, I use the alias myphone
and my router assigns the 192.168.1.4 IP-address:
host myphone
Hostname 192.168.1.4
Port 8022
Then in your Android phone, open Termux and execute whoami
.
Get the user name, and set the password with the command passwd
.
(Optionally) Install rsync: pkg install rsync
Then copy your public key from your computer:
ssh-copy-id -i ~/.ssh/id_rsa.pub -p 8022 <your_phone_ip>
- Start the SSH server from Termux:
sshd
- Get the Android IP network adderss:
ip a
- Rsync from your computer:
rsync -rvlc --exclude={thumbnails,.thumbnails,tmfs,.tmfs,trash,.Trash} --delete-excluded myphone:/sdcard <backup_path_in_your_computer>
To improve security, go to $PREFIX/etc/ssh/
in your phone and modify the sshd_config
file (for example, use nano sshd_config
) and switch the config line PasswordAuthentication
from yes
to no
.
If you have no WiFi available (for example, by train/underground/plane...) or you want to improve the connection speed, you can use a USB cable to connect your Android phone via USB to your computer. USB tethering or ADB USB debugging (recommended) are available. Execute: adb forward tcp:8022 tcp:8022
and you will have SSH connectivity in your 8022 port (localhost) to your Android phone:
ssh localhost -p 8022
.
# Download the apk before
adb push xyz.apk /data/local/tmp/
adb shell pm install -r -d /data/local/tmp/xyz.apk
It seems WiFi + Power charging + Display on output screen + Mobile Data makes powering issues so disable Mobile Data connection fix the issue (really not needed because typically you can use WiFi or Ethernet interface).
Copy&paste works mostly in apps but in terminal apps doesn't work Ctrl-v is not correct shortcut for pasting. That's a reserved key combination. In Termux works:
- Paste: Ctrl+Alt+V
Run command once to disable killing of phantom processes and processes using excessive cpu (recommeded for Termux in Android 12L or 13):
adb shell "settings put global settings_enable_monitor_phantom_procs false"
Install code-server from Termux is easy but have a version that works is not easy:
pkg upgrade -y
pkg install nodejs-lts python yarn binutils
FORCE_NODE_VERSION=FALSE yarn global add [email protected] --ignore-engines;
sed -i -e 's|switch(process.platform)|switch("linux")|' /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/platform/terminal/node/ptyHostMain.js
To start:
code-server --auth none