Getting connection timed out when I try to connect to my self-managed Gitlab instance - ssh

I just installed a Gitlab on my VPS (at gitlab.mydomain.com). Thing is I can connect to it through HTTPS but not through SSH, even if I add a generated SSH key from my VPS.
My firewall doesn't block connections (I set up my UFW to allow connections on port 22)
When doing systemctl status ssh after I try to connect to my Gitlab, I can read things like :
Failed password for root from x.x.x.x port xxxxx ssh2
Received disconnect from x.x.x.x port xxxxx:xx: [preauth]
fatal: Timeout before authentication for xx.xxx.xxx.xx port xxxxx
I'd like to find a solution or to know if somebody already faced this problem (and how did you solve it by the way !)
I also did try to connect from different connections (Wi-Fi, 5G, ethernet) and none of them did work.
I can give more details if needed.
Thanks by advance,
Thibault

Related

Connection timeout while trying to SSH

Hope I'm doing this right as this is my first StackOverflow question. I'm trying to SSH into a server, but running the ssh command results in a connection timeout (using the MobaXTerm client on Win10). I'm trying to connect on port 22, and have gone through Windows Firewall to make rules to open the port, but it's still not working. Any ideas as to why this is happening? I can provide relevant information as needed.
Thanks in advance!
That error message means the server to which you are connecting does not reply to ssh connection on port 22. I think three possible reasons for that:
The server has not installed ssh
You are running ssh with different port
The machine has a firewall that doesnot allow you to connect

Can't access on server after used ufw and forgot to allow port 22 to SSH

I have used UFW on my server, and I forgot to allow port 22 to ssh. Now I can not access on the server. I using hosting by Linode. Please give me a solution, I can not find anything to open port 22, because I can not access it.
ssh: connect to host xxx.xxx.xxx.xxx port 22: Operation timed out
This really should be a support ticket on Linode.
What they would tell you though is to access your Linode "out-of-band" with the Linode Shell a.k.a. LiSH. THey have a Linode Doc.

How to connect to OCI machine if the sshd is not responding?

I was updating the ssh port of an Oracle Cloud Infrastructure machine
I changed /etc/ssh/sshd_config
The port was
#Port 22
I changed it to
Port 40531
Then
restarted the sshd service systemctl restart sshd
open the port on the OCI Web
however, now I cannot connect.
ssh -vvv -p 40531 -i ~/.ssh/vm.key opc#129.xxx.xxx.xxx
OpenSSH_8.2p1, OpenSSL 1.1.1e 17 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname 129.xxx.xxx.xxx is address
debug2: ssh_connect_direct
debug1: Connecting to 129.xxx.xxx.xxx [129.xxx.xxx.xxx] port 40531.
debug1: connect to address 129.xxx.xxx.xxx port 40531: Connection timed out
ssh: connect to host 129.xxx.xxx.xxx port 40531: Connection timed out
I saw a Cloud Shell but I'm not sure if it can be used to connect to the machine to perform maintenance tasks
Is there a way to connect to the VM from the web oci interface to fix the ssh issues?
I used to use a VPS service that has a web console from which you can enter to fix problems like this
is there something like this in OCI?
Note:
SELinux was disabled on the machine
if you are about to do this on your machine, remember to update the SELinux configuration prior restart the sshd service or you will be locked out, another option is to disable SELinux totally (this is what I did)
The changes above described worked well, the only thing that was causing issues on my side
(I don't really know why) is that I was connected from a VPN
After I disconnected the VPN and tried to connected again it worked
Update:
I figured out why the ssh using a different port was not working. The VPN I use is a corporate VPN which has very strict inbound and outbound rules, The VPN outbound rules were blocked by the TCP on port 40xxx.
Update:
if you are struggling with a VM you can connect using the below instruction
Creating the Instance Console Connection
Before you can connect to the serial console or VNC console, you need to create the instance console connection.
To create the console connection for an instance
Open the navigation menu. Under Core Infrastructure, go to Compute and click Instances.
Click the instance that you're interested in.
Under Resources, click Console Connection.
Click Create Console Connection.
Upload the public key (.pub) portion for the SSH key. You can browse to a public key file on your computer or paste your public key into the text box.
Click Create Console Connection.
When the console connection has been created and is available, the state changes to Active.
Thanks to #bmuthuv for the info
You can connect to Serial Console of the VM where you could get access to GRUB Menu during a Reboot operation. You can subsequently use typical Linux commands to get to Shell from Grub. You can subsequently undo anything you would like to.
Serial Console connection can be created on OCI Web Console in the Instance's page.

firewall has blocked ssh. any wayarounds?

I want to connect to remote amazon aws service(EC2 instance) , and I would like to be able to ssh to it from my laptop while using the campus provided network (which has cyberoam firewall). However, they have pretty much every port blocked and ssh won't work. Is there anything i can do? does ssh run through port 80? I don't really know what to do .
All it says is :
ssh_exchange_identification: read: Software caused connection abort
ssh works elsewhere.
You can set your SSH server to use port 80 (or 443 if 80 is used for a webserver). Just check the configuration file of your ssh server for more details!

hg push Connection refused

I use a http://bitbucket.org private repository, usually works well, but now I can't do push.
When I try get this message:
hg push
remote: ssh: connect to host bitbucket.org port 22: Connection refused
abort: no suitable response from remote hg!
Many thanks.
Connection refused means that either their firewall is blocking you or they are not running ssh on port 22 (the default). I would recommend either contacting their customer support or talk to whomever gave you access.
Since port 22 was blocked, I used the alternate URL ssh://hg#altssh.bitbucket.org:443/account_name/repo_name/ as described here.
I had the same problem, and actually this solution helped me out:
vim ~/.ssh/config
Add these lines and save it.
Host github.com
Hostname ssh.github.com
Port 443
Host bitbucket.org
Hostname altssh.bitbucket.org
Port 443
taken from https://gist.github.com/goddoe/5692bfc3cdc374d918a87882963edf36