Jelkner's
Weblog


About me

Blog Posts Blog Tags Blog Feed

2023 2022 2021 2020 2019 2018 2017

Log in

Copyright © 2020
Jeffrey Elkner

Using ssh to Connect to My Ubuntu Phone
March 18, 2018


UBports Logo

About a month ago one of my students told about the UBports project, which appears to be making a viable push to take over Ubuntu Touch after Canonical's abandonment of it, and to continue development using a community foundation. I am longing for a free software phone platform, and despite my disappointing experience with Firefox OS, willing to keep joining whatever effort seems most likely to succeed until one of them actually does. So I didn't hesitate to get myself a OnePlus One, install Ubuntu Touch on it, and make it my day to day phone.

I'll need to move data on and off my phone, of course, and as a GNU/Linux using computer science teacher, I would love to be able to use a command line tool like ssh to do that.

Here is what I did to make that possible:

$ sudo apt install android-tools-adb android-tools-fastboot
$ adb version
$ adb devices
$ adb shell

which gave me a bash shell on my with prompt phablet@ubuntu-phablet:~$, at which I typed exit to return to my desktop shell. From there I made reference to How can I access my Ubuntu phone over ssh? to setup ssh access with:

$ adb shell android-gadget-service enable ssh
$ adb shell mkdir /home/phablet/.ssh
$ adb push ~/.ssh/id_rsa.pub /home/phablet/.ssh/authorized_keys
$ adb shell chown -R phablet.phablet /home/phablet/.ssh
$ adb shell chmod 700 /home/phablet/.ssh
$ adb shell chmod 600 /home/phablet/.ssh/authorized_keys

With my phone connected to my home wifi network, I can now run:

$ adb shell ip addr show wlan0|grep inet

to find its IP address and then use scp to move files back and forth between my desktop computer and phone.