I successfully got SimpleSSHD running on my OnePlus 7T and I can SSH into the phone fine and I can also connect using WinSCP. However, whenever I try to transfer a file, I get an error 127, which apparently means the scp command wasn't found. I can confirm from the CLI that it thinks scp doesn't exist. But does that not come with SimpleSSHD? Am I missing something with the installation? I should add, I am transferring files to /sdcard/*


1 Answer 1


After talking with the app author, it sounds like it's an issue that may not get resolved, but he confirmed that he had to do some funny stuff to get scp working and the Android updates have probably broken it. So I ended up using Termux instead and wrote some documentation on it, in case anyone comes across this later.

Termux Android SSH Server Setup

SSH Setup

  1. Download and install Termux on the phone

  2. Enable File Storage permissions for the app (I had to manually do this)

  3. Start the app and run these next steps in the app

  4. Install dropbear and openssh

    pkg upgrade
    pkg install openssh
    # When OpenSSH asks about overwriting your local config file, answer N to keep the local file
  5. Run the command passwd to generate a login pasword

  6. Start the SSH server

    • NOTE To Stop the SSH server, run this pkill sshd

Ref: https://www.crisisshelter.org/install-ssh-in-termux-openssh/

Key-based Auth Setup (Windows)

Generate Keys

  1. Download https://www.puttygen.com/

  2. Run puttygen

  3. Select:

    1. RSA
    2. Bits: (2048 or 4096 for better encryption)
  4. Click Generate

  5. Wiggle mouse in blank space of program

  6. Copy the public key for pasting into OpenSSH authorized_keys file and save it to a file named authorized_keys

    • NOTE: Output should look like this

      ssh-rsa 1231AD_REALLY_LONG_KEY_HERE_FG123= rsa-key-20220806

  7. Save the private key as id_rsa.ppk

Send Public Key to Phone

  1. Connect to the phone's IP using WinSCP on port 8022
  2. Enter a blank username and then the password set above
  3. Manually change to $HOME/.ssh/authorized_keys (Note, the location of the home directory may be different so use what your path shows)
  4. Transfer the authorized_keys file created above to this folder

Setup Key in Kitty/Putty

  1. Setup the SSH connection as usual, being sure to use port 8022 and the phone IP
  2. Go to Connection->SSH->Auth and select the id_rsa.ppk file saved from puttygen
  3. Be sure to go back to Session to name and save the connection
  4. Click Open to connect
  5. Hit enter to skip the username and it will use the certificate to authenticate

Setup Key in WinSCP

  1. Setup a New Site using the option at the top of the connection list
  2. Select SCP as the file protocol
  3. Enter the phone IP and port 8022
  4. Click Advanced and navigate to SSH->Authentication
  5. Select the id_rsa.ppk generated from puttygen and click OK
  6. Click Save and name the connection
  7. Click Login
  8. Click OK to bypass the username prompt and it will use the certificate to authenticate

Disable Password Authentication

  1. After ensuring you can login using the certificate, log back into the phone using SSH

  2. Edit the sshd config file

    nano $PREFIX/etc/ssh/sshd_config
  3. Modify the following line to this setting:

    PasswordAuthentication no
  4. Save changes and exit with CTRL+X

  5. For good measure, set the password to some random password

    # Enter some RANDOM_STRING
  6. You can exit the shell session now

Termux Logs

SSH daemon does logging to Android system log, you can view it by running logcat -s 'sshd:*'. You can do that either from Termux or ADB.

Ref: https://wiki.termux.com/wiki/Remote_Access

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .