How can I add an additional SSH user account?

Add a new user to the EC2 Linux instance

  1. Connect to your Linux instance using SSH.
  2. Use the adduser command to add a new user account to an EC2 instance (replace new_user with the new account name).
  3. Change the security context to the new_user account so that folders and files you create have the correct permissions:

How do I add a SSH key to an EC2 instance?


  1. Create a new key pair from AWS Console.
  2. Generate Public key from newly created key pair ( Private Key ).
  3. Paste the generated public key ( from Step 2 ) in ~/. ssh/authorized_keys of Server.
  4. Delete the existing key from ~/.ssh/authorized_keys of Server.
  5. Perform ssh using new key.

How do I add a user to my EC2 instance?

  1. In the navigation pane, choose Users.
  2. Choose Add users.
  3. For User name, enter a user name.
  4. For Select AWS access type, select both Access key – Programmatic access and Password – AWS Management Console access.
  5. For Console password, choose one of the following:
  6. Choose Next: Permissions.

How do I SSH into an EC2 user?

Connect to your EC2 Instance

  1. Open your terminal and change directory with command cd, where you downloaded your pem file.
  2. Type the SSH command with this structure: ssh -i file.pem username@ip-address.
  3. After pressing enter, a question will prompt to add the host to your known_hosts file.
  4. And that’s it!

Can an EC2 instance have multiple key pairs?

EC2 doesn’t support multiple Key Pairs by default. And updating Key Pairs (adding new keys, replacing existing keys, or deleting existing keys) is not supported by default. User Data allows you to deploy a bunch of Key Pairs on an EC2 instance during bootstrapping.

How do I SSH a username?

How to Connect via SSH

  1. Open the SSH terminal on your machine and run the following command: ssh your_username@host_ip_address.
  2. Type in your password and hit Enter.
  3. When you are connecting to a server for the very first time, it will ask you if you want to continue connecting.

How do I SSH into an EC2 instance without pem?

4 Answers

  1. Login into your instance with the .pem file.
  2. Update.
  3. sudo su.
  4. cd / (just incase)
  5. Edit, vim /etc/ssh/sshd_config and edit or do the equivilent of uncommenting these lines:
  6. Restart sshd service, service sshd restart or systemctl restart sshd or equivilent.
  7. Set password, passwd.

How do I give someone access to my AWS?

Sign in to the AWS Management Console and open the IAM console at .

  1. Choose Users in the navigation pane, choose the name of the user whose permissions you want to modify, and then choose the Permissions tab.
  2. Choose Add permissions, and then choose Copy permissions from existing user.

How can I add an additional SSH user account with cloud init and user data for my EC2 instance?


  1. Connect to your EC2 instance using SSH.
  2. Run the following command to confirm that cloud-init is installed:
  3. Open the Amazon EC2 console and then select the instance.
  4. Choose Actions, select Instance State, and then choose Stop.
  5. Retrieve the public key from the key pair.

How do I SSH into an EC2 private IP instance?

2. SSH into EC2 Instance from Windows

  1. In PuTTYgen, choose Conversions > Import Key and select your PEM-formatted private key.
  2. Enter a passphrase and then click Save private key, as shown in the following image:

How do I import a key pair in AWS?

To import a public key

  1. ssh-keygen -t rsa -C “my-key” -f ~/.ssh/my-key.
  2. Generating public/private rsa key pair.
  3. aws ec2 import-key-pair –key-name “my-key” –public-key-material fileb://~/.ssh/
  4. { “KeyName”: “my-key”, “KeyFingerprint”: “1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca” }