Forums

SSH Connection timed out

Hello, I have been having problems with pushing code to my live and dev server. I keep getting ssh connection timed out. I tried it first thing this morning and on first try it worked no problem, I pushed to dev then to live successfully. After that I can't seem to push again. Is there a certain amount of time that I need to wait before I can push changes again?

Thanks Brandon

Hmm. That's definitely quite weird. I do not see any problems with ssh connections right now. What was the command that you were using to push?

Hi Conrad, The command I used is: git push 'remotename' 'branchname' When it works I get prompted for my rsa passphrase. The remote is username@ssh.pythonanywhere.com:path/bare-repo.git

That's quite weird. Do you know if a normal ssh to username@ssh.pythonanywhere.com works when the git push doesn't work?

From git bash shell on windows I tried ssh -T username@ssh.pythonanywhere.com and I would get the time out

Could you do a ssh - vvv to get more details?

So on first try it connected and the debug output was quite long. I tried git push and it worked. When I tried to push again it timed out. I then ran ssh -vvv with the following output

$ ssh -vvv brandonl@ssh.pythonanywhere.com
OpenSSH_7.1p2, OpenSSL 1.0.2h  3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to ssh.pythonanywhere.com [23.21.200.247] port 22.
debug1: connect to address 23.21.200.247 port 22: Connection timed out
ssh: connect to host ssh.pythonanywhere.com port 22: Connection timed out

Do you want me to post the successful attempt or can I put it in a file and post or send a link.

Looking at our logs, since ~36hrs ago, I see a whole bunch of failed attempts to login to your account using a password over ssh. Intermittently, I also see some successfully ssh logins using a rsa key.

We block you if you fail multiple auth attempts- most likely you succeed to push once or twice and then the failed password attempts cause you to fail to push anymore.

Are you by any chance putting in the wrong password in a script somewhere? Or maybe when you push, you are putting in the wrong password before using a key or something?

I'm not running any scripts, just git push to get the code to site. I tried to push just now and it didn't work. I got the connection timeout. Below is the console session.

$ GIT_SSH_COMMAND="ssh -vv" git push eltech_test dev
OpenSSH_7.1p2, OpenSSL 1.0.2h  3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to ssh.pythonanywhere.com [23.21.200.247] port 22.
debug1: connect to address 23.21.200.247 port 22: Connection timed out
ssh: connect to host ssh.pythonanywhere.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Not sure if there is anything else I can look at?

Hi there,

So as before, we are continuing to see failed password login attempts for your account. That is why we are blocking access (otherwise someone else may bruteforce your password).

The ip address in question is 99.254.198.49 from Canada. Do you happen to be around there? If so, I would again double check to make sure that you are not somehow doing some sort of automation thing with a wrong password (eg: are you running any backup scripts etc)

Hi Conrad, That seems to be the IP address for my ISP. The only login I attempted yesterday was at the time of my last post. I tried to push twice. For the rest of the day my computer was off. Were there attempts before that time or are you seeing multiple attempts at that one time?

There were consistent login attempts. I will email you the relevant logs.

It seems to have been something with Visual Studio Code trying to sync with remote repos, but didn't prompt for login credentials. I disabled the git.autofetch setting which fixed the problem. Thanks for the help.

Great! Glad you worked it out.

I am getting ssh timed out error ssh -L 3333:milind123.mysql.pythonanywhere-services.com:3306 milind123@ssh.pythonanywhere.com ssh: connect to host ssh.pythonanywhere.com port 22: Connection timed out

[admin edit: format]

C:\WINDOWS\system32>ssh -vvv milind123@ssh.pythonanywhere.com
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug3: Failed to open file:C:/Users/Achint/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolving "ssh.pythonanywhere.com" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to ssh.pythonanywhere.com [23.21.200.247] port 22.
debug3: finish_connect - ERROR: async io completed with error: 10060, io:0000019BCB515260
debug1: connect to address 23.21.200.247 port 22: Connection timed out
ssh: connect to host ssh.pythonanywhere.com port 22: Connection timed out

mysql connection details defined as per the guidelines given however it is not working

From the logs, it looks like you successfully logged in later.

I am connecting to the PA MySQLDb using sshtunnel, mysqlconnector with the code sample that has been shared as an example. But when I put the same code (with block) under try except the system hangs and ultimately fails in mycursor.execute(Query) . Why this is so. It takes a lot of time to execute the connection.cursor statement. I remove the try/except block. The code functions smoothly. I need the try except block to retry the connection . ========================================================================== import mysql.connector import sshtunnel

sshtunnel.SSH_TIMEOUT = 5.0 sshtunnel.TUNNEL_TIMEOUT = 5.0 connection=None mycursor=None try: with sshtunnel.SSHTunnelForwarder( ('ssh.pythonanywhere.com'), ssh_username='Pipsy100', ssh_password='XXXXXXX', remote_bind_address=('Pipsy100.mysql.pythonanywhere-services.com', 3306) ) as tunnel: connection = mysql.connector.connect( user='Pipsy100', password='XXXXXXX', host='127.0.0.1', port=tunnel.local_bind_port, database='Pipsy100$mysite', ) mycursor = connection.cursor() except Exception as e: print("Damage") # Retry again mycursor.execute("CREATE TABLE customers (name VARCHAR(255), address VARCHAR(255))") mycursor.close() connection.close() ==========================================================================

Does the query work well when you run it from PythonAnywhere?