1. ssh-keygen -t rsa -P ""
-> this will generate key pair file in the current user .ssh folder
-> which is in home folder of user just press ctrl + h to show hidden files
-> after giving this command just keep pressing enter dont enter file name or so
it will show -> Generating public/private rsa key pair.
Enter file in which to save the key -> just press enter on this.
after this you will get the shell prompt back there you type
2. cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
-> this will create authorized_keys in .ssh folder and put your public key in that so that
-> you just type ssh localhost it will login to localhost without asking the password.