update: 2020-05

for whatever reason the following SSHDroid app does not work anymore.

please checkout the even easier to use (default port: 2222) and setup: SimpleSSHD (Easy to use SSH server) – https://f-droid.org/app/org.galexander.sshd

# start the ssh server app
# make sure gnu linux is in same LAN/WLAN as android device
# from gnu linux client:
ssh -p2222 123.123.123.123; # (ip of android phone will be shown in app)
# one-time password will be generated and shown in the app
# to become root go:
su - root; # confirm root privileges in app 

workaround for AFireWall+ users: for some reason, had to completely disable AFWall+, then connection worked, then re-enabled it, connection still works, make sure to define exception rule for SSHDroid app)

 

outdated (may work on older android-phones): get a ssh server app, like the very excellent SSHDroid:

officially: https://play.google.com/store/apps/details?id=berserker.android.apps.sshdroid&hl=en
unofficially: (if you trust this server)

https://dwaves.org/software/apps/SSHDroid_2.1.2_44.apk

https://dwaves.org/software/apps/SSHDroid_2.1.2_44.apk.sha512sum.txt

sha512sum SSHDroid_2.1.2_44.apk 
535ec2e1ae2153fe5cb99bcd5ebaaf580b4d1358c77c9bb134f0ecde4601dc0f53c918b95c856a92d8373309ea95e83052a93529a49ef35c196819517b40bd2e  SSHDroid_2.1.2_44.apk

if you are running a custom rom, have rooted your phone and AFWall+ Firewall installed… you will need to allow “(Root) Apps with Root-rights” in LAN

(DO NOT FORGET TO CLICK THE … 3x DOTS TOP RIGHT CORNER AND CLICK ON “APPLY” or your rules will not be applied!)

set a password… default passwords are evil.

go back to home screen, stop/start the SSHDroid (maybe even try to restart your phone)

make sure it shows “ready” / “bereit”

… with the password you specified in the options.

# now you can do cool things like htop ("taskmanager")
# dmesg (boot messages)
# checkout what kernel it is running
uname -a
Linux localhost 3.10.73-ge8c57cd #1 SMP PREEMPT Sun Feb 24 06:35:00 UTC 2019 armv8l

# checkout apps and connections
netstat -pantu
# so you can see the ip of the telegram server
tcp        0      0 192.168.0.101:45060     149.154.167.92:80       ESTABLISHED 9153/org.telegram.messenger
# this is a rather strange connection...
# guess it is just the ip that SSHDroid tries to load adds from
tcp        1      0 192.168.0.101:46383     172.217.16.130:80       CLOSE_WAIT  13865/berserker.android.apps.sshdroid

or just show all files of the / root partition:

interesting to look at…

PS: ping can work, but maybe is blocked.

admin