Unable to SSH into ec2 from MacOSx - macos

I have been trying to connect to my ec2 instance which was working a few hours ago. After I terminated my bash terminal abruptly, it refuses to work now. I'm getting a constant ssh: connect to host ec2-xx-xxx-xx-xx.compute-1.amazonaws.com port 22: Operation timed out error.
It worked on my friend's ubuntu system but fails to work even on my ubuntu.
I've allowed all the inbound and outbound routes too.
Have also used the correct command, made my .pem key private and all. Still doesn't work. What do I do

Check if the instance is turned on or its ip changed. Each ec2 instance has a private IP and a public IP, we should use the public IP of the ec2 to ssh to it. Find the public IP in the aws console.

Verify your attached EC2 security group, and check if the port ssh is open from your network. (with nmap for example).
In the security group validates that the source port is wide open or just open from your current public ip. (the last is more secure / recommended)

Related

How can I make sshuttle working on a dedicated IP of other VPN service?

This is the first time I use the sshuttle.
I am running into an issue working with sshuttle.
I run the sshuttle to connect my local with a remote server on my local machine.
I can access the server by using ssh and pem file.
I used the following command on my MacOS.
sshuttle --dns -vr dev 10.0.0.0/0 --ssh-cmd 'ssh -i ~/.ssh/dev.pem'
I have set ssh config to use the dev hostname in .ssh/config file
host dev
HostName xx.xxx.xx.xx
user root
IdentityFile ~/.ssh/dev
But I couldn't connect my local to the remote server, even all the internet traffic keeps loading and never loads anything.
I am using a dedicated IP on VPN service (PureVPN). Wihtout VPN, sshuttle is working well so meaning that running sshuttle on top of other VPN service is a problem?
I don't think it's a problem since it's a dedicated IP. And if it's a problem, how can I address this issue since I must use the dedicated IP for an another service.
If you have faced the same issue before, please let me know.
Thank you in advance!
From the looks of what you mentioned there could be two things that can be the cause. One, the credentials that are given to you by the third party hosting are incorrect. But since you mentioned that you are able to access the sshuttle without a VPN, this clearly indicates that you need to get your dedicated IP approved from the hosting service if it's not marked spam. If you are looking for a dedicated IP VPN service provider try Ivacy.

Should an AWS EC2 instance connect using only IPv4 Public IP?

If I put the "IPv4 Public IP" of my EC2 instance in the browsers address shouldnt it connect and return an error message instead of just giving time out ?
So, it sounds like you are attempting to connect to the instance via SSH.
Things to check:
The Security Group associated with the instance needs to have port 22 open to either your Public IP address, or to 0.0.0.0/0 (which is not a good security practice)
You are on a network that is not blocking SSH traffic. Some corporate network prohibit such access (so try it from home).
The instance is running an SSH server. This is standard on Linux distributions, such as the Amazon Linux AMI. (Believe it or not, some people wonder why they can't SSH to a Windows instance.)
You should be trying to connect to a public IP address associated with the instance
The instance needs to be in a Public Subnet (which means the Route Table associated with the Subnet is pointing 0.0.0.0/0 traffic to an Internet Gateway). If you are using the Default VPC, then this is done for you.
You have the private half of the keypair that was nominated when the instance was launched. If you are using an Amazon Linux instance, the private half of the keypair would have been automatically copied to: /home/ec2-user/.ssh/authorized_keys
The fact that your connection is timing-out, as opposed to receiving an error message, most likely makes it an incorrectly configured Security Group. (Trust me, it's almost always the Security Group!)

Can't open AWS EC2 instance using Putty

I did the ec2 instance setup and converted private key pair to .ppk format.
When I try to open the instance it's displaying the following error in Putty:
unable to open connection to [host_name] host not found
This is a DNS question. Open a command window and type "nslookup [your hostname]" where [your hostname] is the name of the server you are trying to connect to. If it does not find an IP then you (or someone) needs to add your new server to DNS.
As asked above, does your instance even have a public IP address? If not then you will need to set up VPN for your VPC.

Operation timed out PORT 22, on SSH access to AWS EC2. How to solve it?

I have a instance Linux in an EC2 service that was working before I changed the security group in order to accept HTTP port 80.
Before that change it was only port 22, SSH, we see in the picture below:
After I added HTTP I can't get access trough the terminal and get Time out operation error.
How to solve this issue?
If you stopped the instance, and then started it (not a reboot) then the public IP will change. You can attach an Elastic IP address to prevent that.

SSH connect from local windows VM to Azure windows VM

I want to have a SSH connection from my local windows machine or VM on my computer to Azure windows server VM. I tried Cygwin and Putty but both of them gave timeout connection. I used public ip address and opened port 22 on Azure VM.
I will appreciate if some one can give me any hints or links.
There are multiple firewalls that can be the reason here. Fist you must have a rule on the server to allow incoming SSH requests (port 22). Then you need to configure the NSG(Network security group) to allow incoming on port 22. If it still doesn't work, you need to verify that you are allowed to do an outgoing SSH request from your computer.
Thanks for suggestions, I found the problem which was the host machine IP address(ipconfig) (where is a local VM inside domain) was different from the IP address that communicate outside the domain to internet. I was set in NSG of Azure VM to only accept this IP and because of that it gave time-out error. After changing the IP it works.

Resources