Open main menu

CDOT Wiki β

Changes

OPS335 Lab 1

111 bytes removed, 10:38, 17 January 2017
no edit summary
# You generate the key-pair by issuing the command:
<source lang="bash">ssh-keygen -t rsa</source>
When issuing this command, you will end up with the files: '''~/.ssh/id_rsa''' and '''~/.ss/id_rsa.pub''' (private and public keys)
 === Sharing your Public Key on a Remote server === When issuing this command, you will end up with the files: '''~/.ssh/id_rsa''' and '''~/.ss/id_rsa.pub''' (private and public keys). So far, this topic is generally a repeat of OPS235 lab7.  What you may '''<u>not</u>''' know is that by using a '''"trick"''' (the ''magic'' of public key cryptography), you can SSH to a Linux machine without using a password!<br>
Learning to perform this trick is <u>'''essential'''</u> in this course and in the industry in general. SSH keys are used everywhere that Linux servers are used.
If you have the private key, you can prove to someone who has your public key that you are indeed the '''actual owner of that public key'''. That is how ssh key authentication works. You are then only required to transfer your public key to a remote server.
 You can transfer the public key to a remote server using either of the following methods:<ul><livalue="4">You are going to share the public key from the '''root user in your hostname host machine''' with the '''root user of your vm1machine'''.</li><li>Make certain you are logged on as '''root'''.</li><li>Copy contents of your '''~/.ssh/id_rsa.pub''' from your host machine, and append the contents to '''~/.ssh/authorized_keys''' on each of your Virtual Machine servers</li><li>Simply issue the Linux command '''ssh-copy-id -i ~/.ssh/id_rsa.pub username@server'''<br><br>In your case: ssh-copy-id -i ~/.ssh/id_rsa.pub root@IPADDR_for_vm1</li></ul>
{{Admon/important|Errors in Copying Public Key from Host to VM|If you experience an error when copying the public key from your hostmachine to your VM, it is most likely caused from not permitting root login that you performed in the previous section. Set to allow login from root for each vm, restart your sshd service and then re-run the above command.}}
13,420
edits