Trouble connecting with SSH
-
Hi! I've just flashed my Xperia 10, and it's the first time I'm using Ubuntu Touch. I've tried to set up SSH using this instruction. However, it immediately refuses my connection with the following message:
ssh: connect to host 192.168.1.204 port 22: Connection refused
I've then tried to verify sshd's configuration by runningsudo sshd -t
and got the following error messages (reconstruction):could not load host key /etc/ssh/ssh_host_rsa_key could not load host key /etc/ssh/ssh_host_dsa_key could not load host key /etc/ssh/ssh_host_ecdsa_key could not load host key /etc/ssh/ssh_host_ed25519_key Missing privilege separation directory: /var/run/sshd
I've checked for these keys, and they weren't existing. So, I've generated them myself using
ssh-keygen
. As for the folder — it's generated by the service script, so it isn't a problem.But still, after rebooting the phone, I can't connect to it, with the same immediate
ssh: connect to host 192.168.1.204 port 22: Connection refused
error message.What can I do or where should I look? Thanks in advance.
-
Well, sshd just wasn't running. For some reason,
android-gadget-service
didn't actually do anything. I've started sshd manually by runningsudo /etc/init.d/ssh start
and it works.Info I've gathered when trying to determine if it's running:
I've run
sudo lsof -i -n -P | grep LISTEN
on the phone to know if port 22 is open, but it wasn't in the output, which means nothing is listening on it.Then I've run
sudo ps aux | grep ssh
and no matter if ssh is enabled or not it reports process from/usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session ubuntu-touch-session
command to be in the interruptible sleep (Ss
in theSTAT
column). It doesn't report anything else, exceptgrep --color=auto ssh
due to results being filtered by grep.Now, as I started it, the output also contains
/usr/sbin/sshd -D -o PasswordAuthentication=no
. -
On my bq e5 it took only 2 steps to enable ssh:
- copy my public key to the phone:
~/.ssh/authorized_keys
- enable ssh access using UT Tweak Tool: System > SSH settings > Enable SSH access
- copy my public key to the phone:
-
It turns out the connection is refused before it reaches sshd. Disabled ssh, rebooted, and checked
android-gadget-service status ssh
to ensure it's disabled, tried to connect but got the same message. Also, logs in/var/log/auth.log
don't contain any ssh logs (apart from runningsudo sshd -t
). -
@farkasdvd thanks for the reply! It's helpful to know.
-
Well, sshd just wasn't running. For some reason,
android-gadget-service
didn't actually do anything. I've started sshd manually by runningsudo /etc/init.d/ssh start
and it works.Info I've gathered when trying to determine if it's running:
I've run
sudo lsof -i -n -P | grep LISTEN
on the phone to know if port 22 is open, but it wasn't in the output, which means nothing is listening on it.Then I've run
sudo ps aux | grep ssh
and no matter if ssh is enabled or not it reports process from/usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session ubuntu-touch-session
command to be in the interruptible sleep (Ss
in theSTAT
column). It doesn't report anything else, exceptgrep --color=auto ssh
due to results being filtered by grep.Now, as I started it, the output also contains
/usr/sbin/sshd -D -o PasswordAuthentication=no
. -