Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Don't use a password. Generate a passphraseless SSH key and push it to your VM.

Instructions

  1. If you already have an SSH key, you can skip this step… Just hit Enter for the key and both passphrases:

    localhost:~$ ssh-keygen -t rsa -b 2048
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/username/.ssh/id_rsa): .ssh/mykey
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in /home/username/.ssh/mykey.
    Your public key has been saved in /home/username/.ssh/mykey.pub.
  2. Copy your keys to the target server:

    localhost:~$ ssh-copy-id -i .ssh/mykey user@hostname
    user@hostname's password: ••••••••
  3. Now try logging into the machine, with ssh 'user@hostname' to verify the keys we’ve added:

    localhost:~$ ls ~/.ssh/authorized_keys
  4. Finally check you can log in using your new key…

    localhost:~$ ssh id@server
    user@hostname:~$ 

    You may also want to look into using ssh-agent if you want to try keeping your keys protected with a passphrase.

  • No labels