3

I want to SSH my new Ubuntu phone and tried this instruction but it doesn't work. I get "error: device not found" from every single command.

2
  • 2
    Please edit your question and tell us exactly what you did. Don't just link to another post, show us.
    – terdon
    Mar 27 '15 at 11:16
  • @user392200 I think you can approve an answer now. Working solutions are provided.
    – Peterino
    Feb 11 '16 at 23:45
5

Actually, the only thing you need to do to access your Ubuntu Touch device via SSH is place an authorized_keys file (with a public key of the PC you're using to access the Ubuntu Touch device) in /home/phablet/.ssh/, and enable SSH access via sudo android-gadget-service enable ssh in the Terminal app.

See this answer for an elegant way to get your ssh keys on the device (ignoring the outdated setprop instructions).

Once this is done, you may want to have a way to toggle the SSH server state for extra security while roaming in foreign networks:

  1. SSH into your device: ssh phablet@YOURDEVICEIP
  2. Create a folder for your scripts: mkdir /home/phablet/bin
  3. Fire up nano to create a script: nano /home/phablet/bin/toggle-ssh.sh
  4. Paste the following:

    #!/bin/bash
    if [[ "$(android-gadget-service status ssh)" == "ssh enabled" ]]; then
        sudo android-gadget-service disable ssh
    else
        sudo android-gadget-service enable ssh
    fi
    
  5. Save the script and exit nano.

  6. Make the script executable: chmod +x /home/phablet/bin/toggle-ssh.sh

Now you can easily turn your SSH Server on or off by running: toggle-ssh.sh, as /home/phablet/bin is in the path for your users executables.

Note: If you face permission issues of bash when executing the script from the device terminal app you need to run: bash bin/toggle-ssh.sh

1
  • 1
    If you also want to print the phone's IP address for convenience I've created a Gist from this script that demonstrates how this can be done.
    – Peterino
    Feb 11 '16 at 21:28
0

You can use another method:

Install ubuntu-sdk (ppa:ubuntu-sdk-team/ppa), put your phone in developer mode, open ubuntu-sdk, connect your device to computer, go to devices in ubuntu-sdk and in control, exec open ssh session. And then you can copy your keys, etc, witouth using adb.

1
  • Thanks, when I was in the middle of trying your suggestion, there was another edit... looked easier, and it was. Now I can SSH my phone.
    – user392200
    Mar 27 '15 at 13:34
0

I also faced this issue and resolved it with the help of this post: Tether Ubuntu bq phone

If the adb command above fails, it might be because the vendor of the phone is unkown (it was for me in 14.04). In that case find it with

lsusb
*Bus 001 Device 010: ID 2a47:0c02*

Now add 0x2a47 to ~/.android/adb_usb.ini

Then restart the adb server after you edited the file with:

sudo adb kill-server;  sudo adb start-server

Hope that helps, cheers Andreas

0

Thank you for your information, I finally manage to connect to my phone true SSH.

That's how I did:

  1. Install WifiTransfert from the app store;
  2. Copy your ssh public key to the phone;
  3. add your public key to authorized_key:

    cat .local/share/wifitransfer.sil/id_rsa.pub > ~/.ssh/authorized_key
    
  4. Start ssh service:

    /etc/init.d/ssh start
    
  5. From there, you can ssh your phone. sudo ifconfig to get the IP address.

    ssh phablet@IPADDRESS
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy