key issues : aws EC2-instance - linux

I am facing some login problem for accessing instance. While login to the server console (its a live server) it shows as Permission denied (publickey), Also am accessing with sudo also same issue persists. AWS instance, should reboot, no change while login issue persists.

As explained in AWS docs your key needs correct permissions:
If you are connecting from MacOS or Linux, run the following command to fix this error, substituting the path for your private key file.
chmod 0400 .ssh/my_private_key.pem

If you got a public key when you set up the server and you saved it (.pem file), you first need to change permissions to it. If in Linux cd to the directory holding the .pem file, then do this:
chmod 400 /path/to/your_public_key.pem for only-read permission.
Then with your EC2 instance public DNS ( get it in AWS EC2 console when you click on your instance ID) which is similar to ec2-x-xxx-xx.us-east-3.compute.amazonaws.com ,you can ssh into your server as follows. Assuming your user account name in the server is ubuntu like in most of the Linux based AMIs in AWS, do:
ssh -i your_public_key.pem ubuntu#ec2-x-xxx-xx.us-east-3.compute.amazonaws.com and if prompted for a password, provide it.
Good luck:)

Related

Get permission denied for ssh

I followed this link https://docs.gitlab.com/ee/ci/ssh_keys/README.html#ssh-keys-when-using-the-shell-executor to install SSH key using shell executor.
all the steps were running fine but at the final step when I tried to log in to the remote server in order to accept the fingerprint
by this script ssh gitlab-runner#myserver.com
I receive the following error
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
I added the ssh public key in settings >> sshkey
also add it into variables as SSH_KNOWN_HOSTS
I couldnt find what is the issue , could you help me , thanks
Try a ssh -Tv gitlab-runner#myserver.com in order to check which exact key and paths are considered when trying to read the remote server.
That will give you a clue why the connection fails, when you compare those paths with the ones set up when you inject an SSH key into your build environment by extending your .gitlab-ci.yml.

Connecting Azure Linux VM having Ubuntu installed from powershell throwing Host Verification failed. . . error

I tried to connect to Azure Linux VM where Ubuntu installed from https://shell.azure.com/bash
ssh username#ipaddress
above command is throwing error as Permission Denied (publickey) .
I have created SSH public key and added it to VM while creating Azure Linux VM following below article.
https://learn.microsoft.com/en-us/azure/virtual-machines/linux/quick-create-portal
But still facing Permission Denied issue.
Also, I tried to run bolt command on Azure Linux VM remotely from another windows machine powershell.
I got error as below
Host key verification failed for '10.20.30.40':fingerprint
SHA256:mssgkeghbfnb9883yygebwndjhk is unknown for '10.20.30.40'
How to fix above issues. Kindly suggest.
Permission denied (publickey) means that your public key is not in the authorized_keys file. Copy the public key manually to that user's ~/.ssh/authorized_keys file, or use ssh-copy-id which comes with OpenSSH.
Also, make sure you're SSH'ing to the right user with ssh user#host

Amazon AWS EC2 Key Pair Denied

I have scoured the Internet for answers and had little luck. All I have been trying to do is connect to my AWS EC2 Linux server via SSH.
The.pem file is on my computer, but it has not been accepted. I have tried several FTP clients, including FileZilla and the native Terminal on my Mac.
In FileZilla, my error is the following:
Error:Disconnected: No supported authentication methods available (server sent: public key)
I also have encountered a similar message in Terminal:
Warning: Identity file rejectedFile.pem not accessible: No such file or directory.
Permission denied (publickey).
I have quadruple-checked the file name corresponds to the one in the AWS console. This file was downloaded when I initialized the instance...
I'd suggest you check also these two common mistakes:
Wrong permissions of the .pem file: make sure the file exists with proper permissions (chmod 400)
Default username: use the proper username for your linux distro
Use the ssh command to connect to the instance. You'll specify the
private key (.pem) file and user_name#public_dns_name. For Amazon
Linux, the user name is ec2-user. For RHEL5, the user name is either
root or ec2-user. For Ubuntu, the user name is ubuntu. For Fedora, the
user name is either fedora or ec2-user. For SUSE Linux, the user name
is root. Otherwise, if ec2-user and root don't work, check with your
AMI provider.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html

Permissions to edit deployed files on amazon ec2 (beanstalk)

I have begun a deployment on amazon ec2 I have deployed my war file and putty(d) in sucessfully to the correct instance using SSH (I generated a key pair)
I am logging in as ec2-user (the default) but the file permissions I need access to are owned by tomcat7.
Any suggestions please on how to su in as tomcat7 (or even root)
ok. I used sudo su and that did the trick!

How do I configure multiple ssh access to an EC2 instance

I've been trying to setup access to my Amazon instance to my development team and have hit a bit of a brick wall. I've tried a bunch of different tutorials online & none seem to work. Here's my config:
I have access to the AWS Management Console & I'd rather that I be the central administrator of that account, they don't need to setup new instances.
I have a t1.micro instance setup Running 32 bit Amazon Linux AMI
My developer and I both use Macs. I am able to ssh in to the machine using my key pair that is assigned to the box
I've previously tried to ssh into the machine & add my developers key & but he keeps getting Permission Denied (Public Key)
I setup a keypair for my dev, but its obviously not tied to the account, mine is.
Do I have to setup the developer in IAM so that they login & setup the original key that I had to setup when I first created the account? Could that be what they are missing?
I did get one of them to setup a key on their machine & provide me the RSA info to insert into the ~/.ssh/authorized_keys file, however they still received the error message above. Even when their key was chmod'd correctly, they still received that error. Could that be due to chmod needed on the .ssh folder?
Just trying to get some clarity on requirements of accessing a linux-based EC2 instance that isn't the main admin of the account (i.e. my developers). FYI I trust them with full permissions on the instance.
Thanks.
.ssh directory should be chmod 700.
You don't need to created any IAM user for connection to your ec2 instance via ssh. You just need to add your developer's public key to ~/.ssh/authorized_keys in your instance. Be sure that ~/.ssh owner is ec2-user, it should be like that by default.
Then the developers have to move their private key to ~/.ssh/id_rsa and do:
chown "dev_user"."dev_user" -R ~/.ssh/
chmod 400 ~/.ssh/id_rsa
"dev_user" is the local user for your developers. Then be sure that ~/.ssh folder's owner is the same that id_rsa file and have 700 permission:
chmod 700 ~/.ssh/
The developers just have to do:
ssh ec2-user#x.x.x.x

Resources