Can ping, but can't ssh into phone anymore. (SSHD Running)
As it says in the topic, I can ping from my desktop to my phone and vice versa but can't ssh from desktop into phone. I can go from phone to desktop (I setup keys) I get connection refused when trying to ssh in.
86 Replies
Please make sure you have specified the correct port.
Ports under 1024 are privileged and as such Android does not permit their use by regular apps.
Termux's SSHD defaults to port 8022.
Yes I have.
It's been working fine forever... up until this morning. :/
Fun fact, since Termux is effectively a single user system it actually ignores the username so you can put in whatever you want there.
lmao that's hilarious
You can try increasing the verbosity
ssh -v
or -vv
, (-vvv
also exists but is extremely verbose)You said you had set up ssh keys?
You don't seem to be using those currently.
I have keys setup from Phone -> PC
(that works still)
ah
it's only from PC -> Phone that stopped working. :/
SSHD is running in Termux?
yeah I did a ps -ef |grep sshd
sec
That sure looks like it's running.
"That's what it's mouth say"
š
How are you running
sshd
anyway?
We usually use sv
from the runit
package for service management on Termux.
Are you using that or are you doing it another way?I had a .bashrc thingy setup when I log in (from some reddit post someone recommended)
Right, we should probably set it up through
sv
since that's the way we support it officially.it's a bash script that checks if it's running and then starts it if it isn't.
ahhh ok sorry
let me nuke that setup
Oh no worries, you didn't have a way to know.
I nuked that... killed "server" started it back... and started sshd manually
Right.
You should be able to just install
runit
and enable sshd
.
You might have to restart Termux once, but it should work immediately.sv-enable not installed
Is that not part of the
runit
package?
One second, gotta check that.unable to change to service directory: file does not exist
Ah,
sv-enable
is a utility script we ship as part of termux-services
š It's instaled now.
sv-enable sshd however pooped itself fail: sshd: unable to change to service directory: file does not exist
sv-enable sshd however pooped itself fail: sshd: unable to change to service directory: file does not exist
Is that the full output?
yessir
sv-enable sshd right?
Should be.
termus-services installed successfully
does
echo $SVDIR
return anything?k sec
It should return
/data/data/com.termux/files/usr/var/service
.
And if you run ls $SVDIR
that should look something like this.Okay so we have the service directory.
man you got your propmpt pimped out
lol
I feel like a hobo
starship
, it's a shell agnostic prompt framework.
(I also happen to maintain the termux package of it)ahh nice!
So yeah that screenshot seems correct
So you have a
$SVDIR/sshd
directory?Open port 22?
that's odd.
That... shouldn't be possible.
lol?
I did something (wrong)
I don't understand how port 22 could even be open.
Your phone isn't rooted, right?
Not that I know of gulp
Odd
how do I change the password?
Oh... That could be the issue.
Didn't even think of that.
don't tell me account is locked
lmao
hahaha it is
No, Termux is a single user system so it doesn't have any password.
(I think)
oh... I thought it asked for a pass when connecting
We specifically have a fork of the
passwd
utility just to provide a password for SSH.
You can use passwd
to set a new one.
If that has somehow become unset that would at least explain why you couldn't log in.ok
ideas?
The "password" for Termux gets stored in
~/.termux_authinfo
I'm guessing that got messed with or lost somehow.
As mentioned, you can use passwd
to set a new password.it's gobbledygook
should I just true > $THATFILE
Well it's encrypted...
That is your SSH password after all, don't want it sitting there in plaintext.
hehe
passwd
ok
I think the account is locked
Not sure how to unlock it. passwd -u ?
We don't do that here.
Termux doesn't use a password for anything other than SSH authentication.
Just keep getting Permission denied.
oh let me -vvvvv now
Maximum is 3
-v
's but more doesn't hurt.lol
(It's like mashing a button harder)
nothing stands out
That's good.
but still... the fact that ssh is running on port 22 is odd
Yeah... it shouldn't do that or even be able to do that.
I wonder if I changed that somehow?
You can check
$PREFIX/etc/ssh/sshd_config
sec
cat or ls?
Or
nano
or vim
or whatever.
I guess cat
?
We wanna check if the Port
has been modified.https://github.com/termux/termux-packages/blob/master/packages/openssh/servconf.c.patch
We do specifically patch SSHD to default to 8022.
GitHub
termux-packages/packages/openssh/servconf.c.patch at master Ā· termu...
A package build system for Termux. Contribute to termux/termux-packages development by creating an account on GitHub.
I wonder if there is a way I can use my keyboard as input on my phone without sshing in... (it's a pain in the butt for me to type on my phone)
I mean, we could just make a key pair on the phone and use
ssh-copy-id
to send it over to the PC.
Wait no you said you already did that.no that was from phone -> PC not the other way around.
I don't think. I just put pass in.
oh... h ere's what's odd too... I normally just SSH to that 8022
I don't have any history of me NOT using it
I have my SSH connection for Termux set up as a
Host
section in my ~/.ssh/config
.
That way you can just type in ssh termux
, or ssh phone
.
(I actually have this set up for all my hosts, but this is the one for Termux)I hate to ask this... and I doubt you want to, but I could pop in voice and share screen if that makes this easier.
But I get you might be doing a billion other things
Oh right, we have voice channels.
hehe
pkg rei openssh
GitHub
.dotfiles/.config/starship.toml at main Ā· TomJo2000/.dotfiles
My dotfile repo. Contribute to TomJo2000/.dotfiles development by creating an account on GitHub.
This issue was me. I failed miserable
I was trying to ssh to the wrong IP address.
:GASP:
Starship: Cross-Shell Prompt
Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and Powershell.
Can you hear me?
@#!/bin/env TomIO can you still hear me?
thanks again @#!/bin/env TomIO