Skip to content

Instantly share code, notes, and snippets.

@Iljo
Last active November 30, 2022 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Iljo/b957d077681eb73571c4a1b27787b1ba to your computer and use it in GitHub Desktop.
Save Iljo/b957d077681eb73571c4a1b27787b1ba to your computer and use it in GitHub Desktop.
Mount Android folder locally
#!/bin/env bash
# Local directory to which remote directory should be mounted
LOCAL_DIR=~/mnt
# Remote/Androids directory we want to mount localy, i.e. one of it's
# subdirectories should contain our database file
ANDROID_DIR=/storage/emulated/0/Android/data
# Local port that we want to forward to remotes ssh port
LOCAL_PORT=2222
# Remote port on which ssh server is running
REMOTE_PORT=22
# Actual work
fusermount -u $LOCAL_DIR
adb forward tcp:$LOCAL_PORT tcp:$REMOTE_PORT &&
sshfs localhost:$ANDROID_DIR $LOCAL_DIR -C -p $LOCAL_PORT \
-osshfs_sync,no_readahead,sync_readdir,direct_io,sync_read,cache=no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment