The Public key (id_rsa) is used by the Pi you wish to connect to. This might be a PC, laptop or mobile phone. The Private key (id_rsa or id_rsa.ppk) is required by the client you use to connect to the Pi. You could do this using FileZilla on your local machine to copy the files onto your network. Then : puttygen id_rsa -o id_rsa.ppk Step 4 : Copy Key Files to your local machineĬopy these files from the Pi to a safe location. The following commands will install puttygen and create a PuTTY version of your new key : sudo apt-get install putty-tools I would recommend creating this format now so you have the choice in the future. This process should create two files for you. A Public key named “id_rsa.pub” and a matching Private key named “id_rsa”.Īdd the contents of the Public key to the authorized_keys file using : cat id_rsa.pub > authorized_keys If you use a passphrase do not forget it! Either type a passphrase or leave it blank and press ENTER to finish. It is an extra security step and you will have to decide if you want to make use of it. If you use a passphrase you may be asked for it when using the key. You will be prompted for a location to save the key file. Then run the ssh-keygen utility : ssh-keygen Navigate to the SSH directory : cd ~/.ssh If you want to create a fresh key pair then this is easy to do using the ssh-keygen utility. Next change the permissions on the “authorized_keys” file so only the Pi user can read and write : chmod 600 ~/.ssh/authorized_keys Step 3 : Creating A New Key Pair The permissions on the ssh directory need to be modified : chmod 700 ~/.ssh sshĪnd create an empty “authorized_keys” file : touch authorized_keys Step 2 : Set Permissions To start with navigate to the home directory : cd ~Īnd create a new directory called “.ssh” (note the. Step 1 : Create SSH Directory & authorized_keys File To continue with this tutorial you must have either direct access to the Pi with a keyboard and monitor or remote access using SSH or VNC. In practice the keys are long strings of characters stored in a text file. The public key could be given to everyone but the private key must be kept secret. a Raspberry Pi) and a private key is used by the owner to prove they own the keys. This is a concept where a public key is stored on the remote device (i.e. SSH keys are created using “Public-key cryptography”. Each step includes these markers in the text to indicate what machine you perform that step on. The other machine is the computer you will use in the future to access the Pi. This is the Raspberry Pi and we’ll call this. One is the remote machine you want to access. To help make the process clearer I’ll assume you’ve got two machines. In this tutorial we’ll explain how to create and configure SSH keys so you can connect to a Pi remotely without needing to enter a password. Setting up SSH keys on a Raspberry Pi is relatively easy and can make connecting to one over a network more convenient.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |