Benutzer-Werkzeuge

Webseiten-Werkzeuge


wiki:android

SSH

Das Paket Termux bekommt man z.B. im F-droid Store:

https://f-droid.org/de/packages/com.termux/

Using Termux

Termux brings a whole lot of Linux command line utilities to Android, including rsync and openssh.

You can set up an SSH server on your Android device, then use rsync over SSH, provided both your PC and your Android device are on the same WLAN connection.

The Termux Wiki clearly explains the steps required to set up SSH and use rsync.

To sum up:

Set up Termux

Install Termux Grant Termux filesystem access (Storage permission) from Android settings oder in der Termux Konsole mit:

Open Termux

termux-setup-storage

Set up a password

$ passwd
New password: 
Retype new password: 
New password was successfully set.

Update the list of packages

$ apt update

Optionally, upgrade the existing packages as well (this solved a compatibility issue in my case)

$ apt upgrade

Set up openssh

Install openssh

$ apt install openssh

Start the ssh daemon

$ sshd

It listens on port 8022 by default. To get started, all you need is:

Your username on Termux

$ whoami
u0_a223

The IP address of the Android device

$ ip -4 a | grep wlan0 | tail -1
  inet 192.168.1.101/16 brd 192.168.255.255 scope global wlan0

which, in this case, is 192.168.1.101.

Am besten noch den öffentlichen SSH Schlüssel unter ~/.ssh ablegen und den Schlüssel zur authorized_keys hinzufügen:

cat ~/.ssh/id_sha.pub >> ~/authorized_keys

rsync

Zunächst muss das rsync Paket installiert werden:

apt install rsync

Auf dem PC kann man nun den rsync Kommando nutzen um vom Phone alles was einem wichtig ist zu sichern:

rsync -aue 'ssh -p 8022' --delete --delete-excluded --exclude=Android/obb/ --exclude=Android/data/ --progress u0_a151@phone1:/data/data/com.termux/files/home/storage/shared/ /srv/nfs/USBDisk/Handy/$(date +%Y%m)

When prompted for a password, enter the one you set earlier.

wiki/android.txt · Zuletzt geändert: 2023/09/07 10:15 von techguru