Not able to connet CentOS instance

0

Cant connect or ssh to Cent OS instance but I am able to connect to Amazon Linux or Ubuntu in same subnet, VPC and Security Group. Cant connect to centos instance via putty, instance connect or session manager. error- Failed to connect to your instance Error establishing SSH connection to your instance. Try again later.

2 Risposte
0
  • Make sure the security group attached to the instance allows inbound SSH traffic on port 22 from your IP address or network.
  • Check if SSH service is running on the instance using sudo systemctl status sshd . Restart the service if not running.
  • Verify network connectivity to the instance - check if you can ping the public IP/DNS from your local machine.
  • Check firewall rules on the instance - use sudo firewall-cmd --list-all to check if port 22 is allowed.
  • Generate a new key-pair if using an old one and try connecting with the private key file.
  • Try connecting with verbose mode using ssh -v to check for any errors.

As you mentioned other OS work, it seems an OS-specific issue.

The fact that other OS instances work but not CentOS in the same subnet/VPC indicates it may be something specific to the CentOS configuration. Carefully check the above points.

profile picture
ESPERTO
con risposta 2 mesi fa
0

The error message Error establishing SSH connection to your instance. Try again later. is from EC2 Instance Connect. This comes preinstalled on Amazon Linux and Ubuntu, but not on CentOS, which would explain why you can connect to the other two, but not CentOS https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-prerequisites.html#eic-prereqs-amis

In terms of connecting to the CentOS EC2 with SSH using PuTTY, check that:

  • the CentOS instance is up and running and in healthy state, with 2/2 checks passed in the EC2 section of AWS Console
  • the CentOS instance has a public IP address
  • it's provisioned in a public subnet - that is a subnet whose route table includes a route to an Internet Gateway
  • it's associated with a security group that allows TCP port 22 inbound from your IP address (actually, best to allow 22/tcp from 0.0.0.0/0 while you're troubleshooting, and then tighten it up later)
  • the default user on CentOS could be centos and not ec2-user https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-users.html#ami-default-user-names
  • you're presenting the correct private key in PuTTY
profile picture
ESPERTO
Steve_M
con risposta 2 mesi fa
profile picture
ESPERTO
verificato 2 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande