Skip to content

[Bug]: sshd no longer works #4457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ballo opened this issue Mar 27, 2025 · 10 comments
Open

[Bug]: sshd no longer works #4457

ballo opened this issue Mar 27, 2025 · 10 comments

Comments

@ballo
Copy link

ballo commented Mar 27, 2025

Problem description

This is on the latest F-Droid Termux on Android 15 on a POS Pixel 7.

I used to be able to set the phone to hotspot mode then ssh to the phone via port 8022. For reasons unknown this is now failing every so often. It fails for a long period of time then seems to clear up and allows me to use it again. The port is open according to nmap, and I can still use the phone via scrcpy (adb on port 5555), but when I attempt an ssh it prompts me for a password then fails to provide a shell nor can it pipe sockets via -L or -D. I have tried killing and restarting sshd as well as force quitting Termux to no avail. I'm pretty familiar with all things UNIX and this one has me stumped, so I'm guessing it's something specific to Termux or Android which has put me in this bind.

Steps to reproduce the behavior.

Unfortunately these kinds of problems are difficult to reproduce, but it is happening. I'm not doing anything fancy with Termux. I do have the termus-api app installed so I can monitor the battery level.

What is the expected behavior?

I should be able to ssh to my phone at all times. The phone is still responsive in that I can use adb/scrcpy so it hasn't crashed nor hardly used any memory

System information

  • Termux application version: 0.118.1
  • Android OS version: 15
  • Device model: POS Pixel 7
@twaik
Copy link
Member

twaik commented Mar 27, 2025

Try to capture logs with logcat when it happens and post the logs here, I hope it will make a situation a bit more clear.

@ballo
Copy link
Author

ballo commented Mar 28, 2025

What would I be logging?

@twaik
Copy link
Member

twaik commented Mar 28, 2025

logcat.

@ballo
Copy link
Author

ballo commented Mar 28, 2025

Could be related to Termux app being frozen by Android.

I don't know if this is relevant but I could use termux via scrcpy while this was happening.

@agnostic-apollo
Copy link
Member

Then probably not related, could be network optimizations with screen off

@freebrowser1
Copy link

freebrowser1 commented Mar 30, 2025

I have it sometimes as well (Termux 118.1, Android 14), but it is mostly due to screen off. Turning on the screen fixes it.
Always disable full battery optimizations for the Termux app. In rare cases I had to kick (reboot) my phone and it was fixed.
And are you sure sshd daemon is loaded ? nmap -v -Pn localhost should show open port 8022.
Let it be clear: in most cases I can ssh into my phone using either ssh in a terminal or a GUI sftp client (on Linux and macOS, I don't have Windows).

@twaik
Copy link
Member

twaik commented Apr 26, 2025

You still did not send logcat logs after running sshd.

@ballo
Copy link
Author

ballo commented May 3, 2025

My somewhat crappy work-around is to use scrcpy to gain access to the termux app, killall sshd, then run it again.

@Flexximilian
Copy link

Flexximilian commented May 17, 2025

Have you tried starting it as sshd -D on the command line (to prevent it from daemonizing), and seeing (a) what it prints to STDOUT/STDERR and (b) if having it as a process with an open window fixes the issue? Also, that way you can kill it easily using a simple CTRL-C. And you'll see if the process lives (and how long -- a prompt containing the time helps with that) or if it exists immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants