SSH default keys and management

At this point, you have a Raspberry Pi ready for remote management using SSH. This is good; however, the keys that are installed by default are extremely predictable with every other default installation for OpenSSH. Although this is optional, best practice is changing the default keys. After all, it would be embarrassing if your penetration testing machine got hacked.

Here are the steps to create a new SSH key for your Kali Linux system:

Note

Make sure you use a keyboard and console for the following steps. Do not attempt to perform the following steps over an existing SSH session.

  1. Move the default SSH keys by typing the following into the terminal or command line:
    cd /etc/ssh/
    mkdir default_kali_keys
    mv ssh_host_* default_kali_keys/
    
  2. Generate a new key by using the following command and watching the prompts:
    dpkg-reconfigure openssh-server
    Creating SSH2 RSA key; this may take some time ...
    Creating SSH2 DSA key; this may take some time ...
    Creating SSH2 ECDSA key; this may take some time ...
    [ ok ] Restarting OpenBSD Secure Shell server: sshd.
    

    The following screenshot shows the launch of the preceding commands:

    SSH default keys and management

    The final step is restarting the SSH services on your Kali Linux system using the service ssh restart command.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset