Question

Bluehost only recommends PuTTy. However, is it possible to use ssh keys without any extra, visible programs in Mac?

I would like to have a connection to my server to be a breeze, so that I can control my server in Terminal.

Was it helpful?

Solution

Of course! On Unix and OS X, the ssh-keygen command will generate public and private keys for SSH public-key authentication. The usual way to invoke this command (on the client) is:

ssh-keygen -t rsa

This command will ask you where to place your private key; the default place is ~/.ssh/id_rsa, and the public key will be placed in the file of the same name with a .pub extension added (for example: ~/.ssh/id_rsa.pub). The command also asks you to create a password ("passphrase") for the private key; you can leave it blank for no password as I do, but I don't recommend this practice.

Once you have your public and private keys on the client computer, you need to make your server recognize that public key. If you have shell access to the server, you can upload the public key file with scp, then use ssh to run the following command on the server:

cat id_rsa.pub >> ~/.ssh/authorized_keys 

If your hosting company doesn't give you shell access (though Bluehost does), or this procedure doesn't work, it will likely give you a web interface to the same functionality.

Once your server is set up to recognize your public key, it will allow you access without a password when ssh on the client tries to use your private key for authentication. You may still have to enter your private key's password, but typically you only need to do this once for each client login session.

OTHER TIPS

Sure, I do this all the time. Just follow these directions to generate an SSH key and copy it to your server. The instructions should work on both Mac and Linux.

SSHKeychain is pretty much ideal for this. It lives unobtrusively on the menu bar and integrates seamlessly with OS X's Keychain and SSH implementations.

You will need to use ssh-keygen as described in other answers, but once you've done that you can use SSHKeychain to avoid having to type your private key passphrase all the time.

OpenSSH should be available to you on OS X; open a terminal and check out "man ssh". SSH keys get stored (in a format different from PuTTY) in ~/.ssh. Having a config in ~/.ssh/config can make your life easier, too; you'll be able to say "Use this $SHORTNAME for this $HOST using this $KEY" and similar.

At the terminal prompt do

$ apropos ssh

You should get a list of all the programs Mac OS X comes with related to ssh.

Using the ssh* tools, your ssh keys will be stored under ~/.ssh. PuTTY is nice, but compared to the standard OpenSSH tools, it's really only useful on Windows systems.

Sure can! First run:

ssh-keygen

And go through the steps. It is a good idea to give it a password and such. Then you can:

cat ~/.ssh/id_rsa.pub

and copy-paste the result into the bluehost public key textarea.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top