Logging in without a password in any linux/unix machine can speedup your tasks as a Unix system administrator. Its very useful if you have multiple linux/unix machines, I have two guest OS running FreeBSD and Kali Linux on VMware, my physical OS is Windows 7 x64.
FreeBSD :
192.168.116.130 userid: sofi ( target/remote machine )
Kali Linux:
192.168.116.129 client
- login to kali linux box, cd .ssh ( take note of the DOT ) and do ls -l and you will see only 1 file called known_hosts.
- -rw-r--r-- 1 akira akira 222 Mar 31 14:30 known_hosts
- Now we run ssh-keygen this will generate two files id_rsa and id_rsa.pub
- The id_rsa.pub is what we after
- view the content of this file.
- akira@mmp:~/.ssh$ catid_rsa.pub sshrsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQw5T26curDHgSIqbbfot2LVxWAj9WzYUcViC56xTCvGP+mkZUUJMAL8LAcRa8U/75EcAfwvGB2bzxoethRimqtTWbJKzxVZ85F56Spv02pDrErwVEdnLBYMe+Md+YIvLnnUEzTNZUs839w690m9AKDjr8f1hEBSWiKEiJpzBgiil7Hjqvo1Isvah6In8MWEH0VE9xImpx0Au8zyH87PLpGmPeIcf9CeJ/peO6CJRCajl+3udaqZhFQfSFBCeb3kF7093bsMoS135rI2mT1Ko5CgMrBcalG7JCK2aZZdWHRxjdRm0OAZFHkSKpJbHZc6yy7EP5EMUtPxWEDjpgIupx akira@mmp
- this is the keys that we need to put on the target machine which is a FreeBSD box with IP address of 192.168.116.130 .
- ssh to the target machine and create a hidden file .ssh under sofi's home directory akira@mmp:~/.ssh$ ssh sofi@192.168.116.130 mkdir -p .ssh
- cat id_rsa.pub and redirect the output in the target machine.
cat id_rsa.pub | ssh sofi@192.168.116.130 'cat >> .ssh/authorized_keys' - verify the file on the .ssh directory on the remote/target host which is in this example is a FreeBSD box, once confirmed you can now ssh to the box without a password.
- akira@mmp:~/.ssh$ ssh sofi@192.168.116.130
No comments:
Post a Comment