• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
UBports Robot Logo UBports Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Trouble connecting with SSH

Scheduled Pinned Locked Moved Solved Support
5 Posts 2 Posters 886 Views 1 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      delight_aug
      last edited by delight_aug 14 Feb 2022, 18:21

      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 running sudo 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.

      1 Reply Last reply Reply Quote 0
      • D Offline
        delight_aug
        last edited by 14 Feb 2022, 22:48

        Well, sshd just wasn't running. For some reason, android-gadget-service didn't actually do anything. I've started sshd manually by running sudo /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 the STAT column). It doesn't report anything else, except grep --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.

        1 Reply Last reply Reply Quote 0
        • F Offline
          farkasdvd
          last edited by 14 Feb 2022, 20:21

          On my bq e5 it took only 2 steps to enable ssh:

          1. copy my public key to the phone: ~/.ssh/authorized_keys
          2. enable ssh access using UT Tweak Tool: System > SSH settings > Enable SSH access
          D 1 Reply Last reply 14 Feb 2022, 20:57 Reply Quote 0
          • D Offline
            delight_aug
            last edited by 14 Feb 2022, 20:48

            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 running sudo sshd -t).

            1 Reply Last reply Reply Quote 0
            • D Offline
              delight_aug @farkasdvd
              last edited by 14 Feb 2022, 20:57

              @farkasdvd thanks for the reply! It's helpful to know.

              1 Reply Last reply Reply Quote 0
              • D Offline
                delight_aug
                last edited by 14 Feb 2022, 22:48

                Well, sshd just wasn't running. For some reason, android-gadget-service didn't actually do anything. I've started sshd manually by running sudo /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 the STAT column). It doesn't report anything else, except grep --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.

                1 Reply Last reply Reply Quote 0
                • D delight_aug has marked this topic as solved on 14 Feb 2022, 22:50
                2 out of 5
                • First post
                  2/5
                  Last post