linkedin
  • Become a Seller

Q: How to resolve 'Permission denied (publickey)' or 'Authentication failed, permission denied' errors when accessing the EC2 instance?

  • Harshdeep Singh
  • Sep 20, 2023

1 Answers

A:

Here are some methods you can try to resolve the 'Permission denied (publickey)' or 'Authentication failed, permission denied' errors

  1. Verify the User Name: Ensure that you’re using the correct user name for your AMI.
  2. Check File Permissions: Verify that the file permissions within the operating system are correct and that the correct SSH public key is in the authorized_keys file.
  3. Enter Key File Password: Enter the password for your key file or use ssh-agent to load the key automatically.
  4. Check Instance’s Permissions: Check that the instance’s permissions are correct and the correct SSH public key is in the authorized_keys file.

If you copied your SSH keys from another source, you might encounter a permission denied error. This can happen if the file permissions on the SSH keys are too open. It’s simply not allowed to have 777 permissions on the public or private keys. You can set the following permissions on the ssh directory and its files:


.ssh directory: 700 (drwx------)

public keys: 644 (-rw-r--r--)

private keys: 600 (-rw-------)

authorized_keys: 600 (-rw-------)

known_hosts: 600 (-rw-------)

config: 600 (-rw-------)

You can change these permissions using chmod command.

If these methods don’t work, you might need to check your SSH configuration file or restart your SSH service.

  • Tushar Pandey
  • Sep 20, 2023

2 0

Related Question and Answers

A:

Yes, you can launch EC2 instances with predetermined private IP addresses using Amazon Virtual Private Cloud (VPC).

  • tushar vadhavana
  • Nov 18, 2023

A:

To troubleshoot issues when installing or updating SSM agent on amazon EC2 windows instance, follow the steps given below:

  • Check the EC2 instance's IAM role permissions for SSM.
  • Make sure that your instance has internet connectivity.
  • Review CloudWatch Logs for SSM Agent error messages.
  • Verify that the SSM Agent version is compatible with your EC2 instance's OS.
  • Nilankur Das
  • Feb 29, 2024

A:

You may encounter difficulties updating Windows on your Amazon EC2 Windows instance due to potential connectivity issues preventing access to the Microsoft KMS server, leading to Windows activation errors. You can troubleshoot network and firewall configurations to resolve this problem.

  • Naween kumar Jha
  • Mar 01, 2024

A:

The AWSSupport-TroubleshootRDP runbook enables the user to make changes in the common settings on the targeted instance which might impact Remote Desktop Protocol (RDP), for instance, the RDP port, NLA and Windows Firewall profiles. It is optional that the changes can be done offline by stopping and initiating the instance if the user specifically enables offline remediation. Then the runbook is able to read and provide the utility of the settings.

  • Anjan
  • Oct 04, 2023

A:

To access EC2 instance when RDP is not working:

  • Troubleshoot the error message An internal error occurred.
  • Troubleshoot with an instance screenshot.
  • Confirm that you're using the correct IP address.
  • Confirm that port 3389 isn't blocked.
  • Verify that you are using the right firewall and network configuration.
  • Abhay Kumar
  • Oct 04, 2023
Amazon EC2logo

Amazon EC2

Amazon

4.4

View Details
img

Have you used this product?

Share your experience, help others make better choices!

Add Review
img

Have a Question?

Get answered by real users or software experts

Ask Question

Still got Questions on your mind?

Get answered by real users or software experts

Disclaimer

Techjockey’s software industry experts offer advice for educational and informational purposes only. A category or product query or issue posted, created, or compiled by Techjockey is not meant to replace your independent judgment.

Software icon representing 20,000+ Software Listed 20,000+ Software Listed

Price tag icon for best price guarantee Best Price Guaranteed

Expert consultation icon Free Expert Consultation

Happy customer icon representing 2 million+ customers 2M+ Happy Customers