4

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.

αғsнιη
  • 35,660

4 Answers4

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

Alex
  • 244
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.

  • 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. –  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
    
Seth
  • 58,122
Tr4sK
  • 3