How to enable direct ssh to EC2 linux instance without keypair file

how to enable direct ssh to EC2 linux instance without keypair file

To enable the direct ssh to linux EC2 instance without using keypair file we have to edit the sshd_config file.

Follow the given below steps

Step 1 : Login into linux EC2 instance with the help of keypair. Use the user name which is related to your instance. for eg.

example:
ssh -i keypar_file.pem ubuntu@ec2-1.1.1.1.compute-1.amazonaws.com

Step 2: After login ,edit the /etc/ssh/sshd_config file and make the value of parameter called PasswordAuthentication as yes

vi /etc/ssh/sshd_config

change the PasswordAuthentication value as yes

PasswordAuthentication yes

:wq
save and exit

Step 3: Restart the ssh service.

In Debian or Ubuntu instance:

sudo systemctl restart ssh

In CentOS or Red Hat instance:

sudo systemctl restart sshd

Step 4: Open new terminal in your PC or laptop. ( Do not take the risk,playing safe side )

Now try direct ssh without using keypair file.

for eg.

ssh ubuntu@ec2-1.1.1.1.compute-1.amazonaws.com

That’s it. Now you can check.

8 thoughts on “How to enable direct ssh to EC2 linux instance without keypair file”

  1. Thank you for reply

    I am Oracle DBA exploring AWS cloud and the options available to migrate the on-premise database to Cloud .

    Not much in to Linux and Networking. Your advise will help.

    Thanks

    Reply
    • Hello Mastan,

      These action item require time and skills. Through commenting it is not possible to give each proper direction.
      We offer freelance work for such jobs, if possible contact to our team via email (admin@sharadchhetri.com) .

      Regards
      Sharad

      Reply
  2. Hi ,

    i am new to AWS. So please ignore if its silly question

    i guess we need to have network connectivity between AWS Instance and on-premise server before we can attempt the above plan.

    Reply
    • Hello Mastan,

      Read about public and private ip address.It is must gain basic knowledge.
      In cut short, if AWS EC2 has public IP Address and your location ip is allowed in security group. You should be able to connect via ssh.

      Other than this you can connect via VPN, direct connect also.

      It seems you are fresher hence highly recommend to get more understanding on IP addressing, subnetting and routing at least.

      Regards
      Sharad

      Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.