Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (12.9k points)

1: Is there a way to log in to an AWS instance without using key pairs? I want to set up a couple of sites/users on a single instance. However, I don't want to give out key pairs for clients to log in.

2: What's the easiest way to set up hosting sites/users in 1 AWS instance with different domains pointing to separate directories?

1 Answer

0 votes
by (18.2k points)

You can try the following steps:

Note: I did this for Ubuntu EC2

Step 1: Login as root using the keypair

Step 2: Set up the users and their passwords according to your requirements. You can use the following commands:

sudo adduser USERNAME

sudo passwd USERNAME

Step 3: Edit the SSH configuration, which you can do using /etc/ssh/sshd_config setting

Set the following parameters as given:

  •  For allowing a valid user to login without the key

PasswordAuthentication yes

  • If you want to allow root login without a key as well

PermitRootLogin yes

Step 4: Run the following command to restart the ssh daemon

sudo service ssh restart

Now you will be able to login to your ec2 without the keypairs.

For CenOS instance, follow the above-mntioned steps and replace ssh with sshd in the last step.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

Browse Categories