Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the ssh-keygen command that’s used to create a set of public/private keys that you can use in place of passwords to either log into a system or run commands remotely. The command is used like this:
The -t allows you to specify the type of encryption – dsa or rsa. Notice that you can provide a passphrase to be used or just press the enter key if you want to log in or run commands without a password – which is especially useful in scripts.
Once the keys are generated, you have to copy the public key (e.g., id_rsa.pub) to the other system and account that you want to access.
Once this public key is added to the authorized_keys file on the remote account, you will be able to log from the local account into the remote by using the provided passphrase or no password at all if none were specified when the keys were created.
Try it out:
That’s your Linux tip for using ssh-keygen.
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.