Skip to content

Instantly share code, notes, and snippets.

@bittner
Last active March 5, 2021 20:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bittner/85466c120e7cbe94f4a4 to your computer and use it in GitHub Desktop.
Save bittner/85466c120e7cbe94f4a4 to your computer and use it in GitHub Desktop.
How can I access my Ubuntu phone over ssh? (no `adb shell` required)
#!/bin/bash
# GNU GPL v3 license, (c) 2016 by Alexander Kinne, Peter Bittner
# http://askubuntu.com/questions/601910/ssh-ubuntu-touch/653595#653595
IP_ADDRESS=$(ip addr show primary | grep wlan | grep 'inet ' | sed -e 's/^\s*inet //' -e 's/ brd .*$//' -e 's#/.*##')
echo "Your IP address: $IP_ADDRESS (wlan)"
if [[ "$(android-gadget-service status ssh)" == "ssh enabled" ]]; then
sudo android-gadget-service disable ssh
else
sudo android-gadget-service enable ssh
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment