I have acquired on the marketplace a solution for Ubuntu Trusty, I've create my VM, I just changed the name and try to open by SSH I can't get a connection. This is the error:
"Could not connect to the VM on port 22. Learn about the possible causes of this problem."
One year ago I created a VM and I didn't have troubles, now I don't know why just I can't...
If there was a change in the setup "gcloud" denies an ssh connection, you must update the ssh keys in your metadata:
sudo gcloud compute config-ssh
If the internal firewall of the system block port 22, you can try the following steps to fix it:
Shut down the instance
Click 'Edit' for the instance, under 'Custom Metadata' section, add 'startup-script' key, with value:
#! /bin/bash
sudo ufw allow 22
Click 'Save'
Start the instance again, and SSH into it
Related
I have an ubuntu 18.04 based EC2 instance using an Elastic IP Address. I am able to SSH into the instance without any problems.
apt is executing some unattended updates on the instance. If I reboot the system after the updates, I am no longer able to SSH into the system. I am getting the error ssh: connect to host XXX port 22: Connection refused
Few points:
Even after the updates, I am able to SSH before the reboot
Method of restart does not make a difference. sudo shutdown -r now and EC2 dashboard have the same result.
There are no problems with sshd_config. I've detached the volume and attached it to a new working instance. sshd -t did not report any problems either
I am able to do sudo systemctl restart ssh.service after the updates but before the system restart.
I've tried with and without Elastic IP. Same result
From the system logs, I see that SSH is trying to start, but failing for some reason
I want to find out why the ssh daemon is not starting. Any pointers?
Update:
System Logs
Client Logs
No changes in the security groups before and after reboot
EC2 > Network & Security > Security Groups > Edit inblound rules > SSH 0.0.0.0/0
Step 1: EC2 > Instances > Actions > Image and templates > Create image
Step 2: Launch a new instance using the AMI image.
I missed the error Failed to start Create Static Device Nodes in /dev. in system logs. The solution given at https://askubuntu.com/questions/1301750/ubuntu-16-04-failed-to-start-create-static-device-nodes-in-dev helped solve my problem
I am trying to login to a VM machine but unable to get in there as the below error pops up:
ERROR: (gcloud.beta.compute.start-iap-tunnel) Error while connecting [[Errno 1] Operation not permitted].
kex_exchange_identification: Connection closed by remote host
ERROR: (gcloud.beta.compute.ssh) [/usr/bin/ssh] exited with return code [255].
Command used to log in:
gcloud beta compute ssh --zone "us-east1-b" "user1#test" --project "my-test-project"
When I use the same command from a different machine then it allows me to login to the test VM.
I have been looking at possible solutions related to the firewall settings but unable to get success. Can anyone help here ?
I try to connect with an instance with the command that you post and worked for me when I use it from the cloud shell and from another instances. The error that is given to you could happen for different reason, which are:
The VM is booting up and sshd is not running yet. You can't connect to a VM before it is running.
To resolve this issue, wait until the VM has finished booting and try to connect again.
The firewall rule allowing SSH is missing or misconfigured. By default, Compute Engine VMs allow SSH access on port 22. If the default-allow-ssh rule is missing or misconfigured, you won't be able to connect to VMs.
To resolve this issue, Check your firewall rules and re-add or reconfigure default-allow-ssh.
sshd is running on a custom port. If you configured sshd to run on a port other than port 22, you won't be able to connect to your VM. To resolve this issue, create a custom firewall rule allowing tcp traffic on the port that your sshd is running on using the following command:
gcloud compute firewall-rules create FIREWALL_NAME --allow tcp:PORT_NUMBER
Your custom SSH firewall rule doesn't allow traffic from Google services. SSH connections from the Cloud Console are refused if custom firewall rules do not allow connections from Google's IP address range.
To solve this issue visit this link
The sshd daemon isn't running or isn't configured properly. The sshd daemon enables SSH connections. If it's misconfigured or not running, you can't connect to your VM. To resolve this issue, review the user guide for your operating system to ensure that your sshd_config is set up correctly.
ssh -i "LightsailDefaultKey-ap-south-1.pem" bitnami#[ip-of-lightsail-instance]
ssh: connect to host 6[ip-of-lightsail-instance] port 22: Connection timed out
UPSTREAM_NOT_FOUND
An error occurred and we were unable to connect or stay connected to your instance. If this instance has just started up, try again in a minute or two.
UPSTREAM_NOT_FOUND [519]
PUTTY says
Connection Timeout
Create a snapshot and add script
sudo ufw disable
sudo iptables -F
sudo mv /etc/hosts.deny /etc/hosts.deny_backup
sudo touch /etc/hosts.deny
echo "Port 22" >> /etc/ssh/sshd_config
systemctl restart sshd
sudo systemctl enable sshd
sudo systemctl restart sshd
Wait 10-15minutes. Done! Issue fixed :-)
Ran into the same problem. Managed to log in after rebooting from the browser. My problem started after some upgrades and updates and heavy installations that took up most of my 512MB memory. The solution going forward is to create a swapfile to improve the performance of the system.
I struggled with this 519 Upstream Error for several days in Lightsail as well. I could not connect via SSH-in-Browser, nor via SSH in my Mac Terminal. It simply timed out.
However, I found a solution that works -
In short, you can:
Create a snapshot of the "broken server"
Export to Amazon EC2 (think of EC2 as a more manipulatable version of Lightsail)
Create a new volume from that snapshot in EC2, and mount it on a new machine image
There is a great video here that I followed step by step:
https://www.youtube.com/watch?v=EN2oXVuOTSo
After following those steps, I was able to SSH in to the new volume, and recover all my data in the /mnt directory. You may need to change some permissions with chown to access the data.
Were you able to make your instance working, or it was just data retrieval?
For only data and files, EC2 is not required. You can use AWS cli to create disksnapshot, then create disk, and attach to any instance, mount and then access files.
My SSH connection was done after changing SSH port, just a reboot and use the new port I could connect again.
If this still didn't work, you could resort to the official Adding a Lightsail instance to Systems Manager while launching section, I followed to create a new instance from the snapshot, the new instance is reachable by SSH.
I'm trying to connect to the datalab using the following command:
datalab connect <datalab name> --no-user-checking
it gives the following error message:
Connecting to <datalab name>.
This will create an SSH tunnel and may prompt you to create an rsa key pair. To manage these keys, see https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys
Waiting for Datalab to be reachable at http://localhost:8081/
bind: Address already in use
channel_setup_fwd_listener_tcpip: cannot listen to port: 8081
Could not request local forwarding.
Could someone please help me resolve the issue?
Thanks a lot.
This issue is usually generated when another Datalab or external process is running in the background by using the port 8081. You can kill the existing process or reset the machine where the tunnel to Datalab is running on.
In case you are using Cloud Shell, you can reset it by clicking the "Options" button next to the "Web Preview" button and clicking on Restart option. Afterwards, try to connect again the the Datalab instance:
datalab connect <datalab name> --port 8081
I am having some issues with connecting to ubuntu instance in amazon. I can connect to the default instance with default AMI installation. But when I select ubuntu, I cannot ssh into it.
It says operation timeout. I have tried instantiating other instances rebooting changing key pairs etc.
ssh -i mykey.pem ubuntu#ec2-54-203-164-37.us-west-2.compute.amazonaws.com
ssh: connect to host ec2-54-203-164-37.us-west-2.compute.amazonaws.com port 22: Operation timed out
The strange thing when I stop the instance, then only the ssh command connects and says the are you sure you want to verify the fingerprint thing.
I can easily log into the micro instance with the default AMI installation
I have added the ssh port in the security group as well
Have you tried connecting via Putty ,just use a ppk file and please check once
also you can add ICMP to your Security Group and check for ping resposnses
Regards
Devashish