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.
??? What if you want to login to other linux machine without using password :
just copy the content of id_rsa.pub file content which will be like
-> ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgzkpbse/CEj3WHeEj+D0sd5Ghejo
/simicYhsOzBBxBIssW7GH1nB+g7GThkBzmMlqfoMl7Gc7GvCmxzXCXklvKAGpZsvTrHPkUhLC
jMf9RWNMh0m8g9b/C0mf5QvL+k5DKhAdoTdVomjVarDG/vAv4wk6yZ8fFEGNLiBOLjllCisu3dQgb
HwQIjhR4t6ng2F+mjFSfCap1w1WokMOeGO8wgS0ArRcY00YtqT2TM3FH/XGU0LUxjRpQ9A4WR
7bPEKMzu1hYCUevV0eZEDuQSwSm8OzMrkOj2dHaNjJG1jZouOyhyR7Ciy9DhQZBYZPWAKS
Dr6xOgfZfZ4dXlidJ6n user@ubuntudomain -> Your user name and machine name
and create a file called authorized_keys in the target machine's .ssh folder and paste this key
if everything is done correctly you can just type "ssh targetmachine" you can login without password.
Remotely copying the key to users pc you can use "SCP" command :
scp /home/<user_name>/.ssh/id rsa.pub ip address of targetmachine :/home/<user_name>/.ssh/master.pub
No comments:
Post a Comment
Thank you for Commenting Will reply soon ......