- Login as a
ec2-userto the instance
$ ssh -i ~/.ssh/<key> ec2-user@<ip-address>- Create user
$ sudo useradd newuser- Allow ssh access for the user
Login as new user
$ sudo -su newuserCreate ssh directory
$ cd /home/newuser
$ mkdir .ssh
$ chmod 700 .ssh
$ cd .sshAdd ssh key
$ touch authorized_keys
$ chmod 600 authorized_keys
$ echo "<public_key>" > authorized_keys- Validate access
$ ssh -i ~/.ssh/newuser-private-key newuser@<ip-address>