TermuxT
Termux2y ago
4 replies
treecosia_44893

ssh connection: ran 'sshd' yet 'port 22: Connection refused'

Specs


- Hardware: Software
- Galaxy Tab A7 Lite (model name: SM-T220): Android 14
- Raspberry Pi 5 (8GB): Raspberry Pi OS


Msg




Hello, I was trying to use ssh with these 2 devices: here's what happened:

- Android device (host):

pkill sshd
sshd



~ $ cat $PREFIX/etc/ssh/sshd_config
PrintMotd yes
PasswordAuthentication yes
Subsystem sftp /data/data/com.termux/files/usr/libexec/sftp-server



- Raspberry Pi (client)

alinuxchap@libertus-desktop:~ $ ssh u0_a239@192.168.1.76
ssh: connect to host 192.168.1.76 port 22: Connection refused
alinuxchap@libertus-desktop:~ $ ssh -vvvvv u0_a239@192.168.1.76
OpenSSH_9.2p1 Debian-2+deb12u3, OpenSSL 3.0.13 30 Jan 2024
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.1.76 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/alinuxchap/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/alinuxchap/.ssh/known_hosts2'
debug3: ssh_connect_direct: entering
debug1: Connecting to 192.168.1.76 [192.168.1.76] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10
debug1: connect to address 192.168.1.76 port 22: Connection refused
ssh: connect to host 192.168.1.76 port 22: Connection refused


What I've tried


- both devices connected to same WiFi network (I checked the ip address assigned to the Android device by the router in its Wifi Settings); I also checked the router 'dashboard' (the settings you're able to change just by accessing its local ip address)
- in Termux
- execute
whoami
and
passwd
beforehand
- see if anything came up in
logcat -s 'sshd:*'
while connecting (but nothing was outputted for some reason)
Solution
you'll need to connect to different port
sshd -p 8022

and then on your raspberry pi, connect to it on port 8022
Was this page helpful?