Amazon AWS EC2 SSH Login Through Putty on Windows - amazon-ec2

Ok, so I've read the tutorial here:
http://www.powercram.com/2009/07/connecting-to-aws-ec2-instance-linux.html
I created a keypair on Ec2, and ran it through puttygen, and tried to login via putty. I tried logging into the ip of the site, the url of the site, and the public DNS given to me by Amazon. I've tried logging in as root, ec2-user, ubuntu (even though I think its a fedora install, I'm just not sure because I just inherited this project). The name of the keypair on amazon's interface is hooper, so I tried logging in as that. Every time I get "server refused our key". I've read many peoples post on this problem, and none of the solutions seem to work for me. If any one has any other ideas, I'd appreciate it.

Make sure the instance is running under the keypair you think it is - you have to ensure the key PEM file you ran through PuttyGEN is the actual key that the instance is authenticated with.

Related

Command Line to retreive CyberPanel/Snappymail admin dashboard password on Ubuntu Virtual Machine

I recently purchased a VPS with amazon lightsail and I installed cyberpanel. As I am setting up my websites and email server I realized that I was not able to send out emails but can receive them just fine. I later found out that amazon blocks the ports on EC2 instances. So in order to use a work around I have to attach my SMTP server from AWS SES into the SMTP settings in the admin dashboard of the SnappyMail webmail dashboard. But In order to log in as admin to access it I need a password that I dont have. Since I installed cyberpanel on this Ubuntu 20.04 instance I was hoping that it would be a command line that I can type in to see what the current password is or maybe even reset or change it. Please help me
I tried to look it up on youtube but I kept getting videos that referred to rainloop. And all though it looks the same they are different softwares and I cant access it the way that I was shown in the 2 videos that I found
Run nano /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/admin_password.txt
you will find the Password of snappymail
then (Ctrl+X) to exit NANO edit

EC2 instance putty re-used keypair not recognised

First up it's nearly impossible to identify if this is a duplicate or not given the generic nature of the displayed error. This is potentially a very specific and niche scenario. Please do not falsely mark this as duplicate. It's sad that I have to type this :(
I have 2 ec2 ubuntu instances. The first one created 6 months ago and working perfectly.
I created a second ubuntu instance this morning and told it to use the same keypair as the existing instance. They're in the same zones(?) but different base vpc. I selected it from the list so I presume it should be visible to both vpc's. From what I could see that should be ok.
Both are ubuntu so the user is "ubuntu". Both are using the same key pair. I merely cloned my saved putty config and changed the public IP before attempting to connect however i'm getting the "PuTTY Fatal Error: Disconnected: No supported authentication methods available (server sent: publickey) OK: error.
Unless i'm mistaken the same .ppk should work for both instances, that's the entire purpose of keypairs. The only thing I can presume is that AWS failed to associate the key pair with the new instance.
What are the likely reasons for this happening?
AWS documentation https://aws.amazon.com/premiumsupport/knowledge-center/linux-credentials-error/
Says to check the username "ubuntu" and key pair name which are both correct.
I'm going to blow the instance away and start again but it would be nice to be able to know what AWS is doing wrong so I can avoid the issue in the future.
Update: New instance... I imported a different pub key and used that and the problem persists when I try and connect with it's associated ppk.
The issue was the AWS Amazon Machine Image (AMI) I was using. I was using the latest ubuntu??. When I switched to the other ubuntu it worked fine.

Unreachable Amazon EC2 Instance

I have a running amazon-ec2 instance that contains a personal wiki. It has been running fine for years, and today suddenly I'm unable to logon using the private key .ppk file using either Putty or WinSCP! (An hour ago I still can!)
I was panicking and I rebooted the amazon EC2 instance. (I didn't stop and start the instance, I choose reboot).
My question is, is my data lost? And if not, how can I recover it? I can't ssh to the machine and it seems my .pem file or .ppk file which I generated long time back doesn't work anymore.
Your help is much appreciated, it saves me a lot of hard work! Thanks!
You can try starting another ec2 instance, and attaching the EBS volume(of the instance you care about) to it. Then all you have to do is to mount it and your data should be intact.
You'll have to turn off the original instance to do that first. Also, this presumes you don't have the drive encrypted.
Your data will be lost only if you used instance store. If you used EBS, your data is intact.
If you can't SSH to your server, use "AWS Systems Manager" to shell into your instance and debug SSH connection: check if sshd is up, .ssh/authorized_keys file contents and permissions, etc...

SSH-ing to Google Compute Engine instance through Mac OS X terminal

I have created an instance on Google Compute Engine, but I can't seem to SSH using the terminal. The command that I used was :
gcloud compute ssh example-instance
The error that I got was:
ERROR: (gcloud.compute.ssh) Could not SSH to the instance. It is possible that your SSH key has not propagated to the instance yet. Try running this command again. If you still cannot connect, verify that the firewall and instance are set to accept ssh traffic.
When I googled the error, I was led to this link:Unable to SSH to Google Cloud
I went and checked the firewall rules here https://cloud.google.com/compute/docs/troubleshooting#ssherrors and things seem fine. I also went onto ~/.ssh and checked for google_compute_engine and google_compute_engine.pub which indicate the presence of my private and public key. I was wondering what I should do next? Is this is a problem specific to Mac workstations?
Any help would be really appreciated.
Personally, had some trouble getting my ssh keys setup correctly by following the Google Cloud Engine docs. Found another logical solution...
This didn't take long and solved the problem (i.e., simple ssh access to Google Cloud VM via MacOS Terminal)...
Follow these simple instructions provided by nixCraft:
https://www.cyberciti.biz/faq/google-cloud-compute-engin-ssh-into-an-instance-from-linux-unix-appleosx/
Here are a few other things to check:
Can you ssh into that instance from a browser, using the "SSH" button in the Cloud Console?
If not, try a newly created instance using default settings and compare how your example-instance differs.
Run gcloud config list and confirm that the values for project, account, region, and zone match your expectations.

Unable to connect to SSH server with cloud 9

I've got a digital ocean VPS which I'd like to connect to with Cloud 9's code editor. They have a simple form, which I filled out with the fill out with the required information:
hostname: xxx.xxx.xx.xx
username: stephen
nodejs binary path: /usr/bin/nodejs
Your SSH key: mYpUbLicKey...uploaded through cloud 9's interface
initial path: (optional--I've left blank)
port: (optional--I've left blank)
I get the following error:
Cloud9 couldn't connect to SSH server stephen#xxx.xxx.xx.xx
It's on the default port and allows access to the stephen user (although I tried the above with "root" user and still no dice). Is there something I'm missing here? I tried the exact same commands on the Secure Shell chrome app and I'm able to access the server just fine.
Also I was able to get this to work doing, I believe the exact same thing, but then I realized that I should probably not be doing everything using the root user (I'm a little new at this) so I created the stephen user and changed the information in order to use that user instead. That's when it stopped working. Is it possible that I've given inadvertedly denied access to cloud9 by adding this additional user.
I should also add that I've followed the instructions in cloud9's documentation edited the authorized keys on the server to include the public key that's stored on cloud9.
Any ideas? I know it might be difficult to know what the problem is here, but if someone had an idea at least about where to look, I'd really appreciate it. Thanks.
Could it be that you didn't add the ssh key to ~/.ssh/authorized_keys in the homedir of the stephen user?
Had this same issue even after following the instructions on the documentation. Make sure you're allowing SSH from 0.0.0.0/0 onto port 22 for the EC2 instance.

Resources