Generating a Public/Private key for use with ssh (OSX)

Quick note so I don’t forget this for next time…

ssh-keygen -f ~/.ssh/[keyname]

e.g. ssh-keygen -f ~/.ssh/myuser

This will generate two files: –

myuser.pub             <- public key

myuser                     <- private key

The latter of the two files is your private key. Keep it secret, keep it safe. The former is your public key. That’s the one you’ll need to supply to someone to get access to a remote server that you’re going to ssh to

oh, and one other thing. You may need to chown the .ssh directory to 600 so it has enough rights to be accessed for the login. (chown -R 600 .ssh)

 

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: