top | item 42365772

MagiskSSH – SSH server on Android without Termux

134 points| Oxodao | 1 year ago |gitlab.com | reply

81 comments

order
[+] lutusp|1 year ago|reply
From the linked Gitlab writeup: "Some changes to OpenSSH are used from Arachnoid's SSHelper." I'm very glad to see this port of open-source code I wrote years ago, especially now that Google has removed SSHelper from the Google Play store (BTW still available at https://arachnoid.com/android/SSHelper).

After years of trying to keep up with Google's perpetual Android tweaks, I gave up and accepted that they would eventually remove any apps that weren't updated for each new Android version.

These events only remind me how out-of-date I am as a programmer. I wrote and released my first major title, Apple Writer (https://en.wikipedia.org/wiki/Apple_Writer) in 1979. It lasted for six years in various forms, then was replaced by better programs. I wasn't a corporation, I was an individual, and my programs (then and since) have been individual projects.

In modern times, individual releases are rare, and in the future are likely to be even more rare, replaced by collaborations between developer teams and AI.

Not saying things were better in the past. Just different.

[+] freedomben|1 year ago|reply
I'll say things were better in the past. It's obviously subjective, but I hate the direction things are going.

The user is now viewed as a security threat to their own device, the hyper-churn culture of the javascript ecosystem is now embedding in other areas even systems (like Android, as you point out), "updates" for apps and to a lesser but growing extent OSes, are routinely pushed and forced on users regardless whether they contain new bugs/regressions or horrible UI/UX changes, more and more software is becoming proprietary SaaS and "subscription" based, and backwards compatibility is for the birds. In the name of "security", tech companies and even individual devs are turning our own home networks into opaque spy apparatuses that make network connections that we (the owners of the network) can't even inspect. Even maintaining self-hosted apps is becoming a several-hours-per-week job.

It feels like during the late 00s and early 10s we had some real golden years of open source, but now the poisonous engineering culture that pushes the above things is poised to squash it as a "daily driver" for people. For example, once Microsoft completes their requirements for TPMS and can do hardware attestation like Apple and Google, the ratchet of websites not working (or not working completely) unless the device passes hardware attestation will start, and it will make life on a Linux laptop/desktop similar to how Tor is now where you get endless CAPTCHA hell and nobody cares because you're in a tiny minority of users and many of the tools that provide technological liberation for an individual are also tools used by gray and black hat actors.

And I haven't even gotten to the Apple-ization of everything where it's becoming all about building walled gardens. I remember when compatibility was a selling point of hardware/software.

It's not all bad of course, but it does feel like a lot more bad than good is developing. Happy Monday everyone!

[+] therealmarv|1 year ago|reply
I think this is a bit overkill for my taste with root but depends on use case.

I'm SSHing regularly into my Android phone (and it does not need root) for backup purposes. Used various apps for that but settled for years on Termux.

* Install https://f-droid.org/ store

* Install Termux from there

* Install ssh daemon and rsync in Termux with

    pkg upgrade
    pkg install openssh rsync
* Read manual on https://wiki.termux.com/wiki/Remote_Access#Using_the_SSH_ser... on how to start, configure, stop ssh daemon. In general: The Termux documentation is good!
[+] dotancohen|1 year ago|reply
I use `adb shell` very often on my Android phone. What are your use cases for SSH where adb does not suffice?

Not arguing, just curious.

[+] 0x38B|1 year ago|reply
> ... It also includes rsync (which actually was my main motivation for this project)

I would take rsync any day over unreliable GUI apps that silently fail to complete remote transfers, often as soon as the screen is turned off.

I've used an iPhone for the past few years but may move to a Pixel running GrapheneOS for my next phone. It's apps (well, modules) like this and Termux that tip the scales in Android's favor.

[+] razemio|1 year ago|reply
Sadly, termux now has its own issues since android 12+. It is possible to work around the limitations, when you do not have an Android Phone with MDM enabled and have no problems with turning on dev tools and start remote adb from time to time. I no longer use it because of those reasons. However, there appears to be a native terminal in android 15. Maybe this will be the game changer I waited for.
[+] ForHackernews|1 year ago|reply
You might also check out /e/OS - https://e.foundation/

It's less hardened than Graphene, but more user-friendly (IMHO) and similarly avoids Google spyware.

[+] colordrops|1 year ago|reply
I've found that synchthing on Android is very reliable when setup properly.
[+] noman-land|1 year ago|reply
GrapheneOS is incredible. Nearly perfect OS.
[+] jcul|1 year ago|reply
Graphene OS do not recommend or support rooting as far as I know.

Though I'm pretty sure you can just flash magisk / magisk modules as you would with any other ROM.

[+] trallnag|1 year ago|reply
With every new Android release I'm afraid that Google decides to limit all these freedoms we have on Android
[+] colordrops|1 year ago|reply
I've found that synching on Android is very reliable when setup properly.
[+] n144q|1 year ago|reply
Sadly you are in the vanishing minority of Android users who care about this. Most people just want a phone that works. So much that many people switch to iPhones because, admittedly, many things are work better in their walled garden, and the phone is "simpler" because the OS hides many details or doesn't allow you to do anything.

I used to spend lots of time trying different ROMs, figuring out SU and SELinux stuff, and fighting with SafetyNet. These days I just use stock Samsung ROM. I still have Termux on my devices but only use them occasionally when I don't have a laptop next to me and need to do some hardcore stuff. (I might even switch to iPhone someday because the password autofill experience on Android is just atrocious and infuriating while Google has done almost nothing for the past few years.)

[+] tetris11|1 year ago|reply
This looks good.... but I don't get the importance of it. What can this do that termux openssh can't?

Can I mount remote filesystems at the system level via sshfs?

[+] noname120|1 year ago|reply
Termux gets killed easily, even if you set it to unrestricted in your battery-saving settings. Here is one of the mechanisms that causes Termux (and other apps) to be killed: https://github.com/agnostic-apollo/Android-Docs/blob/master/...

This module isn't affected by battery-saving mechanisms because it runs as a system process rather than an app process.

[+] dataflow|1 year ago|reply
Yeah I had the same question. Why would I prefer this?
[+] hagbard_c|1 year ago|reply
Installed it just now - don't forget to enable incoming connections on the firewall (AFWall+) if you happen to use one - and did some experimenting, especially to find out whether it would open up the device to the deluge of ssh probing. Even though those probes will (in a sane universe) not succeed they're unwelcome anyway. I do notice the device listens on port 22 on both IPv4 and IPv6. Fortunately it is possible to change this by editing /data/ssh/sshd_config where I disabled IPv6 (not necessary in this context) and changed the listening port. You never know on which network your device will end up after all.
[+] Oxodao|1 year ago|reply
Great tip! I will apply it to my setup
[+] nickcw|1 year ago|reply
I wonder if that includes the SFTP server component of openssh?

If so it would be very useful for use with rclone. I back up my phone by running an sshd in termux then using rclone with sftp remotely. This works very well (until the phone decides on a whim to kill the sshd!).

[+] chasil|1 year ago|reply
On my LineageOS device, /product/bin contains scp, sftp, ssh, sshd, and ssh-keygen along with a startup script.

In f-droid, there is also a "primitive FTP server" that includes an SFTP, but that probably gets killed unless you are very careful.

[+] tacomagick|1 year ago|reply
The project looks awesome. If this was also done using Shizuku it would be pretty cool aswell.
[+] paravz|1 year ago|reply
my rsync backup use case over usb and adb (with adb root)

start rsync daemon: adb root adb forward tcp:6010 tcp:11873 adb shell "rsync --daemon --port 11873 --config=/sdcard/rsyncd.conf &"

rsync: rsync -rltHDhP --stats --size-only --append-verify --partial --delete rsync://localhost:6010/root/data/data/ /backup/data

cleanup: adb kill-server

/sdcard/rsyncd.conf for the phone: address = 127.0.0.1 uid = root gid = root [root] path = / read only = true

[+] sammyo|1 year ago|reply
A (super easy to set up) rsync on IPhone that can "see" the itunes music folder would be a huge boon and likely change the world for the better!
[+] dboreham|1 year ago|reply
Interferes with Apple's ideas on how to make more money.