0

So I created an OpenSSH server on a win-7 machine, I can now successfully login on it, but only on that machine too. What I meant is, I can only login on the server when my client is on the same PC as the server.

Now on ny android I am trying to connect, but it's way too long and I often got "timeouts" stuff. Why? Is it the firewall? I have already set and inbound rule on the server, so I don't think that it is.

The username I am trying to use on the android client is the same name that my PC (the server) has. As I created the Key using puttygen on the server itself and added the public key on the "authorized_keys" file.

On my android I used the private Key generated by puttygen.

More info:

  • I created the Key on the same PC that I installed the server.
  • I used the Private key that was generated by puttygen(on the PC) to login on ny android SSH client. (ConnectBot)
  • I can successfully get the cmd on the PC by typing this command ssh -i C:\myprivatekey.ppk localhost
  • on my android I used this:
    • I used the private key as I used above(after copying it from the PC).
    • I used the name of the PC which was ah lic as the usernane on my android ssh client.
  • Does the connection work reliably on those occasions where you don't get a timeout? – kasperd Oct 29 '18 at 12:08
  • See if you can enabled client level verbose logging and then review those logs when there is the timeout issue and see if it provides any clue. Do the same for server level logs and see what it reports during those periods for that client connection as well. Further, consider rebooting firewall appliance and/or routers after you make applicable rules for the traffic to go through those as I've seen this be cleared up by new router config rules and those needing to be rebooted after the configuration before the wacky router routed without the wackiness it exhibited on the new configs. – Pimp Juice IT Oct 29 '18 at 13:00
  • I wasn't aware that you could use the server private key to authorize clients like this, and you probably shouldn't. It's called a private key for a reason. If you're able to connect sometimes then I guess it works but what I always do is generate a public/private keypair on the client device and then add the client's public key to authorized_keys on the server. Then you provide the public key of the client to the server upon login. AFAIK that's how you're supposed to do it. Also, you should be using the username that you're trying to login to OpenSSH as, not the hostname of the PC. – Layne Bernardo Oct 29 '18 at 17:40
1

Edit /etc/ssh/sshd_config on the server and add (if it's not there) at the bottom UseDNS no then restart the SSH daemon.

Will stop your machines from resolving DNS and will speed up the process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.