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.
- 36,350
4 Answers
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:
- SSH into your device:
ssh phablet@YOURDEVICEIP - Create a folder for your scripts:
mkdir /home/phablet/bin - Fire up nano to create a script:
nano /home/phablet/bin/toggle-ssh.sh 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 fiSave the script and exit nano.
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
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.
- 86
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
Thank you for your information, I finally manage to connect to my phone true SSH.
That's how I did:
- Install WifiTransfert from the app store;
- Copy your ssh public key to the phone;
add your public key to authorized_key:
cat .local/share/wifitransfer.sil/id_rsa.pub > ~/.ssh/authorized_keyStart ssh service:
/etc/init.d/ssh startFrom there, you can ssh your phone. sudo ifconfig to get the IP address.
ssh phablet@IPADDRESS