fbpx

Key generation

Raspberry Pi configuration guide to use RSA authentication with the RaspController application

To generate new SSH key type the following command in the Raspberry PI terminal:

ssh-keygen -t rsa -m PEM

confirms the name of the file with ENTER and enter a passphrase (recommended).

 

If you don’t use any passphrase you need to edit the file /etc/ssh/sshd_config with 'PermitEmptyPasswords yes'.

SSH


Edit the file ‘sshd_config’:

sudo nano /etc/ssh/sshd_config

edit the line ‘AuthorizedKeysFile’ removing the # symbol (if present) and adding:

.ssh/id_rsa.pub

 

Save the content of the file pressing CTRL + X (to exit from nano), respond “Yes” at the request of saving, then confirm with ENTER.

Now reboot the ssh service with:

sudo /etc/init.d/ssh restart

or reboot the Raspberry PI.

RaspController


Copy the id_rsa file generated by the Raspberry Pi to your Android device.

Then import the private key id_rsa to RaspController.

Only for root user


The previously created keys are placed in the ‘pi’ user folder, now you also need to copy the public key in the root directory.

Create the ssh directory (if not exists) [~ is Alt Gr + ì]:

sudo mkdir ~root/.ssh

Copy the key:

sudo cp ~/.ssh/id_rsa.pub ~root/.ssh/id_rsa.pub