AWS: Linux EC2 SSH new user password setup

Step 1: Login as ubuntu

The default user for AWS EC2 Ubuntu server is ubuntu

Initial login with .pem file

the filename.pem can be path to that file e.g. ~/.ssh/filename.pem


  • The server location is follow @ sign. If you don’t know this click “Actions” in the AWS EC2 dashboard and then “Connect” this will show up.
  • If you lose .pem file, you have no choice but delete and create new EC2.

The default user ubuntu is special since:

  1. This is not root user
  2. This user has admin privilege
  3. This user has no password i.e. sudo without password

Create new user for SSH login

In this example, user001

Adding sudo special power

Bonus, checking this user is working

Enable user/pass login from outside

restart the server to make it load the new config i.e. sshd_config

Now we’re done with creating user/pass login