Running ubuntu on EC2 instance. I want to setup Jenkins SSH with my github server, but when I run the command
ssh -vT git#github.com
I receive the following output:
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [192.30.253.113] port 22.
ssh: connect to host github.com port 22: Connection timed out
My ssh key for jenkins is located in the /var/lib/jenkins/.ssh folder, but it looks as if ssh config data is being read in the /etc/ folder
I have added the public SSH key to my github account and have verified that I did so as one line.
What else am I missing?
I came across this Creating SSH keys for Gerrit and Hudson as a potential reason why it is not connecting, but I find it highly unlikely that the last time this occurred for somebody was 5 years ago.
This looks more like a networking issue as you receive a Connection timed out error.
So, first check that you can really connect to the github server, e.g. using nmap or telnet; the output should look like this if networking is ok:
$ telnet github.com 22
Trying 192.30.253.112...
Connected to github.com.
Escape character is '^]'.
SSH-2.0-libssh-0.7.0
ssh keys are usually located in $HOME/.ssh/ (where $HOME is the home directory of the user that runs the Jenkins master) -- the folder /var/lib/jenkins/.ssh looks at least unusal.
The directory /etc/ssh contains system-wide ssh configuration data, it will always be read and is not intended for user-specific configuration items.
Turns out that EC2 doesn't seem to let me connect to github via port 22.
I tested this via Alex O's suggestion that I attempt to telnet into git
My solution:
Use SSH through the HTTPS port
Change the config file for github to
ssh through 443
Profit
Major cred to #AlexO
Related
Essentially I cannot connect to an SSH server anymore. Whenever I try to connect I get the following error:
ssh: connect to host HOSTNAME port 22: Connection refused
Note that I am able to connect from a different machine. Hence, the issue seems to be client side. Furthermore, I also cannot pull/push to git repositories that are cloned via ssh. Again, when pulling I get the following error:
ssh: connect to host github.com port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists
It seems like I somehow nuked my SSH installations/config files. I have reinstalled SSH but this did not fix the problem. Any ideas?
Note that you never "connect" to github.com directly (no interactive shell)
As mentioned here, "Connection refused" means
invalid IP address for github.com (manual entry in /etc/hosts or your resolver)
firewall along the way to github.com which blocks the ssh traffic (eg. local firewall or corporate firewall)
So is the other machine (where you do succeed) on the same network?
Check if the other machine SSH config file was not using ssh.gthub.com port 443 (instead of the default github.com:22, typically blocked in a corporate environment).
I ask you for help because I was unable to access the OpenShift web console, installed in a VM, from my pc.
I am not an expert on linux, so please excuse me if I make any mistakes in exposing the problem.
I followed these steps:
I accessed the shell of the VM via SSH.
I successfully installed CRC on VM following this guide: https://crc.dev/crc/#installation_gsg.
I added at the end of my computer's etc/hosts file the following line: 127.0.0.1 oauth-openshift.apps-crc.testing console-openshift-console.apps-crc.testing downloads-openshift-console.apps-crc.testing default-route-openshift-image-registry.apps-crc.testing canary-openshift-ingress-canary.apps-crc.testing
I tried to access the web console of Openshift via SSH with this command: ssh -L 443:console-openshift-console.apps-crc.testing:443 myuser#xxx.xx.x.xxx
But I got the following error message: ssh: connect to host xxx.xxx.xxx.xxx port 22: Connection refused.
If it helps, by running the same command with -v flag, I get: debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
What could be the problem? Did I do something wrong or did I forget any configuration to do?
Many thanks in advance.
So I've had this problem before at work, then it was solved by getting a new computer (it was old).
Yesterday everything worked fine, this morning I try to surf to the company gitlab and couldn't connect. When I try to clone a repository to my local system I get a port 22: Connection timed out and when I try it with https I get port 443: Timed out
On chrome I get "ERR_CONNECTION_TIMED_OUT"
Edge tells me "There was a temporary DNS error. Try refreshing the page.
Error Code: INET_E_RESOURCE_NOT_FOUND"
I've pinged the ip and I get "Request timed out"
When I run $ ssh -vT git#github.com it gives me a bunch of lines but it ends in
debug1: No more authentication methods to try.
Permission denied (publickey).
If I run $ ssh -vT git#gitlab.company.com I just get
OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to gitlab.company.com [10.1.10.21] port 22.
cddebug1: connect to address 10.1.10.21 port 22: Connection timed out
ssh: connect to host gitlab.company.com port 22: Connection timed out
I've regenerated SSH keys and put them in https://gitlab.com/profile/keys (that I can acces, its just the gitlab.company.com that doesn't work).
I talked to IT at the company and they said nothing has changed, no new firewalls, no nothing.
I did install the Chrome Test Server to start making PWA but removed it after I discovered I had this gitlab problem again thinking it might have to do something with it. I rebooted my pc after the uninstall.
What more can I do? I'm on Windows 10 and run Ubuntu in Oracle VM virtual box (where I can connect just fine).
Thanks.
EDIT:
I've done a system restore to a couple of days ago, didn't help, I logged in a different windows account, still couldn't connect, I've changed network cable (using a coworker his "internet") still doesn't work. There must be something that I'm doing locally that messed things up.
I have generated ssh keys from my terminal and placed an entry in my SSH keys section in github.com.
After that, I am just trying to clone my repository, but I get the following error message :
git clone git#github.com:XYZXY/XXXXXXXXXX.git
Initialized empty Git repository in /home/XYZXY/.ssh/XXXXXXXXXXXXX/.git/
ssh: connect to host ssh.github.com port 22: Connection refused
fatal: The remote end hung up unexpectedly
I tried this one too :
ssh -T git#github.com
ssh: connect to host ssh.github.com port 22: Connection refused
My question is :
1) Is source side blocking the connection ?
2) Is Target not allowing the connection ?
Try running this command for more information.
telnet ssh.github.com 22
You should see something like this.
~ $ telnet ssh.github.com 22
Trying 192.30.253.122...
Connected to ssh.github.com.
Escape character is '^]'.
SSH-2.0-libssh-0.7.0
If you do not, then something (possibly a firewall block?) is preventing you from accessing github.
I'm trying to connect to an AWS ec2 instance but I keep being refused.
I'm using the same computer, the same wifi but suddenly when I connect to one of my ec2 instance, it fails.
when I connect, it says..
ssh -i successintoeflcom.pem ec2-user#52.68.152.179
ssh: connect to host 52.68.152.179 port 22: Connection refused
ssh -v successintoeflcom.pem ec2-user#52.68.152.179
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 26: Applying options for *
ssh: Could not resolve hostname successintoeflcom.pem: nodename nor servname provided, or not known
I looked at /etc/ssh_config line 26, and found
Host *
SendEnv LANG LC_*
something got to be wrong, but I haven't found a way to make it right.
I also tried deleting the ec2 instance and make new one with new ssh key and new EIP but it did not work.
honestly, I'm new to ssh settings. Any help would be appreciated.
PS
For some reason, I was able to connect to other ec2 instance that is on other aws account, which I use for work.
Start with checking the VPC configuration: ensure the internet gateway is associated properly with the subnet; ensure the SSH port (22) is opened in both the security group and the network ACL.
You can follow the guide and the troubleshooting described in the blog-post configure VPC and create SSH connection to a Linux-based EC2. It touches the traffic rules configuration and explains how to define the SSH keys properly.
Check the Security groups inbound settings, make sure ssh protocol
enabled with source as anywhere. Because your System IP address might
change.
Check with .pem file permission. It should be set with chmod 600.