Rsync analogue of airdrop

К сожалению на android нет airdrop сервиса, а то, что есть (airdroid, nearby share) не вызывает особого доверия.

Для быстрого обмена файлами между устройствами находящимися рядом бывает удобно использовать rsync. Для этого они должны быть подключены к одной wi-fi сети (это всегда можно сделать используя одно из устройств в кажестве точки доступа).

В termux выполните установку необходимых пакетов

# Установка необходимых пакетов
pkg update
pkg install rsync
pkg install screen

# создать сессию с названием rsync
# если нужно выйти <ctrl>-a-d
# если нужно зайти в ранее созданную сессию
#   screen -x rsync
# для скроллинга нужно перейти в режим копирования
#   <ctrl>+a+<esc> (<esc> - выйти из режима копиравания)
screen -S rsync

mkdir rsyncd

Создайте файл rsyncd.conf:

log file=/data/data/com.termux/files/home/rsyncd.log
read only=true
use chroot=false
port=5667

[test]
path=/data/data/com.termux/files/home/rsyncd

В screen сессии запустите демон rsync

rsync --daemon --config=rsyncd.conf -v

It should be runned on 5667 port or any other great than 1024.  Ports less than 1024 are not allowed.

Check if process is running ps aux.

You can stop rsync daemon using kill command.

Check if rsync daemon is listening port nc -l 5667. It should get error port already binded. Standart commands to show open ports like  ss -tul don't work by security reason (not enough privileges). Also you may look at log file tail -f -n 30 rsyncd.log.

Now you can leave from screen session using <ctrl>-a-d

Now run ifconfig and check your local network ip address. It should starts with 192.168.x.x or 10.x.x.x.

On computer (laptop, tablet or smartphone) that should receive files move to the destination directory and run

rsync -acv -P rsync://192.168.102.232:5667/test .

It copy files between devices over local wi-fi network really fast and It will not use roaming traffic. Also it can be useful where isn't internet connection at all. For example, in wild nature or on yacht in the sea.