Skip to content

Instantly share code, notes, and snippets.

@pavankjadda
Last active October 27, 2023 16:54
Show Gist options
  • Save pavankjadda/bfb3e68b867d7d03b6dc50ef68e72203 to your computer and use it in GitHub Desktop.
Save pavankjadda/bfb3e68b867d7d03b6dc50ef68e72203 to your computer and use it in GitHub Desktop.
Generate SSH Key with custom name

Create new Private and Public key on Host machine (Ex.macOS)

$ssh-keygen -t rsa
# Enter location and file name like (/Users/pjadda/.ssh/minishift_rsa), do not use default files
#Passphrase is optional

Create .ssh folder in Guest OS even if it exists

$ssh docker@192.168.64.3 mkdir -p .ssh

Finally append a's new public key to docker@192.168.64.3:.ssh/authorized_keys

$cat .ssh/minishift_rsa.pub | ssh docker@192.168.64.3 'cat >> .ssh/authorized_keys'

Set permissions on Guest machine (192.168.64.3)

$ssh docker@192.168.64.3 "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"

Now you can SSH into guest with out password

$ssh docker@192.168.64.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment