Skip to content

Instantly share code, notes, and snippets.

@lyshie
Last active November 16, 2021 20:32
Show Gist options
  • Save lyshie/11420e13e7036e5c812a4358b1f93717 to your computer and use it in GitHub Desktop.
Save lyshie/11420e13e7036e5c812a4358b1f93717 to your computer and use it in GitHub Desktop.
Backup Android device via SSHelper and rsync
  • Install SSHelper or 08.30.2018 Version 11.9
  • mount Android device via sshfs
    $ printf "admin\n" | sshfs root@192.168.0.101:/ ~/mnt -o port=2222,password_stdin
    
  • use rsync to backup all files
    $ rsync -avH --progress ~/mnt/storage/extSdCard/DCIM .
    
  • passwordless login
$ ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ''
$ ssh-copy-id -i ~/.ssh/id_rsa.pub -p 2222 192.168.0.101
  • systemd automount
$ sudo vim /etc/fstab
lyshie@192.168.0.101:/    /misc/j7    fuse.sshfs    noauto,x-systemd.automount,_netdev,users,allow_other,reconnect,port=2222,IdentityFile=/home/lyshie/.ssh/id_rsa,uid=lyshie,gid=lyshie 0 0
$ sudo systemctl daemon-reload
$ ls /misc/j7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment