Problem connecting via SSH from Windows to AWS Linux Instance [Permission denied; (publickey,gssapi-keyex,gssapi-with-mic)] - amazon-web-services

I launched an instance & downloaded my secret key. I've attempted this on 2 different devices and instances. Im trying to connect to the instance so I can upload files. Whenever I attempt to connect, this permission denied message displays.
Note I've downloaded and used openSSH
PS C:\WINDOWS\system32> ssh -i C:\Users*\Downloads*key.pem #ec2----.us-west-2.compute.amazonaws.com
The authenticity of host 'ec2----.us-west-2.compute.amazonaws.com (...)' can't be established.
ECDSA key fingerprint is SHA256:.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'ec2----.us-west-2.compute.amazonaws.com,...' (ECDSA) to the list of known hosts.
*#ec2----**.us-west-2.compute.amazonaws.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
PS C:\WINDOWS\system32>
P.S. This is my first post, so constructive criticism on etiquette is welcome :)
Recently started my first job (an internship really) in the IT field. 3 months ago working for a start-up. Im hoping to migrate eventually to something in the field of cloud security, OSINT, DevSecOps, Web Development. Passionate about information security, open source software.
I followed this tutorial from amazon on how to connect to my instance
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/openssh.html

Looks like it's an issue with .pem file permissions. Check this video & see if you can resolve the error.
You can use puttygen to get ppk file which is helpful to SSH from windows.
If you want to use .pem files, mobaxterm is good software to use

You are very welcome to the community, it's nice to know you started your first Job!
To get you started on how to connect to the AWS Linux instance there is a nice KB article Connect to your Linux instance from Windows using Windows Subsystem for Linux and another one using putty look at here & another SO thread.
There are a few thing you need to learn as Prerequisites:
Verify that the instance is ready
Verify the general prerequisites for connecting to your instance
Install the Windows Subsystem for Linux (WSL) and a Linux distribution on your local computer
Copy the private key from Windows to WSL
Then use :
ssh -i /path/key-pair-name.pem instance-user-name#instance-public-dns-name
OR
ssh -i /path/key-pair-name.pem instance-user-name#instance-IPv6-address
From using your Windows CMD:
PS C:\WINDOWS\system32> ssh -i C:\Users\<user_name>\Downloads\testkey.pem ec2-user#ec2----.us-west-2.compute.amazonaws.com
OR
PS C:\WINDOWS\system32> ssh -i C:\Users\<user_name>\Downloads\testkey.pem ec2-user#<Some_IP_Address>
Better Use mobaexterm and copy user key in there and you will there:

Related

Key not present on Coral Dev Board when configuring MDT with macOS host machine

I am currently following the Coral Dev Board configuration guide using a MacOS machine running Catalina as my host machine. As per the instructions, for me to use the MDT command line tools on my specific host machine I must manually configure mdt. I used the following guide step-by-step but end up with the following error when I try to connect to the board.
Waiting for a device...
Connecting to jumbo-goose at 192.168.0.78
Key not present on jumbo-goose -- pushing
It looks like you're trying to connect to a device that isn't connected
to your workstation via USB and doesn't have the SSH key this MDT generated.
To connect with `mdt shell` you will need to first connect to your device
ONLY via USB.
Cowardly refusing to attempt to push a key to a public machine.
I would greatly appreciate if someone would be able to assist me in debugging this issue. I have reflashed my device a few times so I am unsure where the issue is emerging.
On the Coral Dev Mini I had similar issues with generating ssh keys, especially when I switched from a Windows to Linux machine. The easiest was (though not as secure) is to follow these steps and allows ssh with a password. First you will need to connect with a USB cable.
https://serverpilot.io/docs/how-to-enable-ssh-password-authentication/
To edit use sudo nano /etc/ssh/sshd_config
The key is to set: PasswordAuthentication yes
Check the sha25sum of the key file transferred to the dev board is the same as on MacOS, mine didn't match i.e the cut and paste wasn't quite right. With key file transferred manually using a SD card it worked first time on mdt devices/mdt shell commands.

Connecting Visual studio Code to AWS Ec2 instance gives Timeout in VSC But works from ssh clients

I have created the ec2 instance for my education purpose via the link provided from my university.
I have done all the procedures and now can connect to the server from ssh client (i am using xshell).
Now I want to connect to the server from Visual studio code. Everywhere I look on the web, the routine procedure of creating the SSH config file and providing the path of the config file in the VSC's remote development setup for connection is given. I have done all that and I still get a timeout and connection fails. Please help.
Provide ssh command like: ssh hello#21.12.114.12 -A.
And just select a path to save configuration, eg. [HOME]/.ssh/config. It's a local file.

AWS EC2 Windows SSH Help - Chmod 400 (RSA Key).pem Not Working

Thank you all who use their time to help others. Thank you in advance.
I am taking a class on EDX for Linux command line. I have attached the instructions I have followed to set up Red hat using Windows 10. But the SSH for isn't working it says that RSA Key not found. (Attachment didn't work)
I paste it here
"The recommended way to access your Red Hat Enterprise Linux cloud instance for this course is
to use Secure Shell (ssh​) to get an interactive shell on the system.
Step 1: Getting SSH
If you are using macOS or Linux: The OpenSSH command (ssh​) should already be installed on
your computer. Start a terminal program to get a shell, and proceed to the next step.
If you are using Microsoft Windows, you will need to get an SSH client as follows:
● Option 1: Download Git for Windows​ from https://git-scm.com/download/win and install
it using the default settings. When it is installed, right-click on your desktop (not an icon
or a file) and select Git Bash Here​ to open a Git Bash​ command prompt. An SSH client is
provided with Git Bash​ and you can continue with Step 2.
● Option 2: If you have the PuTTY client, which can be downloaded from
http://www.chiark.greenend.org.uk/~sgtatham/putty/, and you are familiar with that
tool, you can use that to connect to your instance. AWS provides a tutorial on this at
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html.
Step 2: Connecting to your instance with SSH
From the Amazon EC2 console, in the left-side menu under INSTANCES​, click Instances​ to
display a list of the instances you have running. This is probably just the one you set up for this
course. Select its checkbox and click Connect:"
Also, I have another PC I built running on Ubuntu. Can I use that PC with the RSA by logging into AWS account if there is no solution.
I have researched this question and I am stuck here trying to find a solution so I can start class.

How to set a remote django develop environment?

I have to set a development environment on a ubuntu machine(16.04).
It's django+postgresql+Nginx, I.think I could install all these things together on that machine,but I totally don't have any idea about how to connect it by using pycharm running on my pc, and how to manipulate the database.
Is there anyone could tell me how to connect it. This is the first time I have to use a remote machine.
By the way, my pc and ubuntu machine are in the same LAN, but there is another person who were asked to write db are not.
I hope I could get some suggestions from the community.
One of the best and common way is to use SSH.
Here you can find an official guide on how to enable SSH server on Ubuntu 16.04
You can use Putty to connect from Windows PC to your SSH server or if you're using Mac or Linux, there should be already installed SSH client. So, just ssh username#servername
Use SSH. Assuming you're on Linux, open a terminal and type:
ssh username#local-ip-address-of-machine
and then type your password when prompted. Your terminal window essentially acts as a terminal on your remote machine. From here, I suggest you research Docker in order to set up a custom environment for your Django project. I have only told you how to connect since that's your question, and there are plenty of tutorials on setting up Django and Docker. If the other person wants to connect, you will need to port forward on your router port 22 on the local IP of the machine.
If you haven't got SSH set up, this page tells you how.

PuTTY secure copy client | -bash: pscp: command not found |

I am trying to learn the Amazon's AWS - EC2 service and was following its tutorial (at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html)
I have successfully launched an instance and am on Step:2, Connect to your instance. I got PuTTY and followed the tutorial for connection using PuTTY (at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html)
Here I am unable to use the command - pscp -i C:\path\my-key-pair.ppk C:\path\Sample_file.txt ec2-user#public_dns:/home/ec2-user/Sample_file.txt as it shows the following error : ' -bash: pscp: command not found '
My main aim is to use an online free temporary server to host a RESTful API that I have made and tested on localhost in python3.
I am a beginner in this field and would like some help.
Thank you.
pscp is Windows program.
You are not supposed to use it in PuTTY terminal (on the virtual machine shell), but on your local Windows machine.