<p>I have previously used <a href="https://f-droid.org/en/packages/org.primftpd/" class="uri">https://f-droid.org/en/packages/org.primftpd/</a> to enable sftp to my android phone</p>
<p>For more information on How to mount remote storage using sshfs, see <a href="https://hackerpublicradio.org/eps.php?id=1944">hpr1944 :: sshfs - Secure SHell FileSystem</a></p>
<p>Also you will need to know about some useful tools for working with Android Devices <a href="https://hackerpublicradio.org/eps.php?id=3515">hpr3515 :: ADB and scrcpy</a></p>
<p><img src="eps/hpr3638/thumb-01-simplesshd-icon.png" alt="simplesshd-icon" /></p>
<p>I found <a href="https://www.galexander.org/software/simplesshd/" class="uri">https://www.galexander.org/software/simplesshd/</a></p>
<p>SimpleSSHD is an SSH2 server based on dropbear that supports scp, sftp, and rsync. It only supports public-key based authentication (no password/interactive auth except for bootstrapping). It does not use root, which means it must listen on a port over 1024 (defaults to port 2222).</p>
<h2 id="install-from-fdroid">Install from fdroid</h2>
<p><a href="https://f-droid.org/en/packages/org.galexander.sshd" class="uri">https://f-droid.org/en/packages/org.galexander.sshd</a></p>
<p><a href="eps/hpr3638/02-SimpleSSHD.jpeg"><img src="eps/hpr3638/thumb-02-SimpleSSHD.jpeg" alt="Start Screen" /></a> </p>
<p><a href="eps/hpr3638/03-port-number.jpeg"><img src="eps/hpr3638/thumb-03-port-number.jpeg" alt="Changing Port Number" /></a> </p>
<p><a href="eps/hpr3638/04-path.jpeg"><img src="eps/hpr3638/thumb-04-path.jpeg" alt="Changing Path" /></a> </p>
<h2 id="before">before</h2>
<pre>
laptop$ adb root
laptop$ adb shell
phone: # cd /data/user/0/org.galexander.sshd/files
phone:/data/user/0/org.galexander.sshd/files # ls -al
total 56
drwxrwx--x 2 u0_a268 u0_a268 4096 2022-06-17 12:06 .
drwx------ 6 u0_a268 u0_a268 4096 2022-06-17 11:59 ..
-rw-rw-rw- 1 root    root     490 2022-06-17 12:05 authorized_keys
-rw------- 1 u0_a268 u0_a268  475 2022-06-17 12:07 dropbear.err
-rw------- 1 u0_a268 u0_a268  650 2022-06-17 12:03 dropbear.err.old
-rw------- 1 u0_a268 u0_a268    6 2022-06-17 12:06 dropbear.pid
-rw------- 1 u0_a268 u0_a268   83 2022-06-17 12:03 dropbear_ed25519_host_key
</pre>
<h2 id="commands-to-run">Commands to run</h2>
<pre>
phone:/data/user/0/org.galexander.sshd/files # restorecon -F authorized_keys
SELinux: Loaded file_contexts
phone:/data/user/0/org.galexander.sshd/files # chmod 600 authorized_keys
phone:/data/user/0/org.galexander.sshd/files # chown u0_a268:u0_a268 authorized_keys
</pre>
<h2 id="after">after</h2>
<pre>
phone:/data/user/0/org.galexander.sshd/files # ls -al
total 56
drwxrwx--x 2 u0_a268 u0_a268 4096 2022-06-17 12:06 .
drwx------ 6 u0_a268 u0_a268 4096 2022-06-17 11:59 ..
-rw------- 1 u0_a268 u0_a268  490 2022-06-17 12:05 authorized_keys
-rw------- 1 u0_a268 u0_a268  475 2022-06-17 12:07 dropbear.err
-rw------- 1 u0_a268 u0_a268  650 2022-06-17 12:03 dropbear.err.old
-rw------- 1 u0_a268 u0_a268    6 2022-06-17 12:06 dropbear.pid
-rw------- 1 u0_a268 u0_a268   83 2022-06-17 12:03 dropbear_ed25519_host_key

laptop$ sshfs -p 2222 192.168.1.123: /mnt/phone/
</pre>
