Step 1: Create a key pair on your local linux server anjani@local-host$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/anjani/.ssh/id_rsa):Enter key Enter passphrase (empty for no passphrase): Press enter key Enter same passphrase again: Pess enter key Your identification has been saved in /home/anjani/.ssh/id_rsa. Your public key has been saved in /home/anjani/.ssh/id_rsa.pub. The key fingerprint is: 33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9 anjani@local-host Step 2: Copy the public key [FILENAME.pub] on remote ec-2 instance on the user’s home directory Step 3: go to .ssh directory and if this directory doesn’t exist then run below and required directory will be created [ec2-user@ip-10-235-54-114 ]$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/ec2-user/.ssh/id_rsa):Enter key Enter passphrase (empty for no passphrase): Press enter key Enter same passphrase again: Pess enter key Your identification has been saved in /home/ec2-user/.ssh/id_rsa. Your public key has been saved in /home/ec2-user/.ssh/id_rsa.pub. The key fingerprint is: 33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9 ec2-user@ip-10-235-54-114 Step 4: Once you are inside .ssh directory create a file named authorized_users if it doesn’t exist $touch authorized_keys $chmod 600 authorized_keys $cat ~/FILENAME.pub >> authorized_keys Step 5: anjani@local-host$ ssh ec2-user@publicdns/ip Step 6: You should be able to log in to remote ec-2 instance