Configuring ssh keys


In this post I’ll explain how to setup ssh keys on a Mac so you no longer have to enter a password when connecting to a remote machine (generally *nix based) using ssh.

If you don’t have homebrew installed consider doing so now. To quote the authors: “It’s the missing package manager for OSX”. Whilst not entirely necessary it will allow us to easily install the prerequisites.

  1. Install ssh-copy-id which allows us to upload the public key to the remote more easily.

brew install ssh-copy-id

  1. Create the public and private key pair file locally providing an optional password. This will get stored under ~/.ssh. Specifying a filename is optional.
    1. ssh-keygen
  2. Now we need to put the public key on the remote server. The tool we installed in step 1 will allow us to easily do this.

ssh-copy-id user@serverip-or-name

  1. That’s it! ssh onto the machine using the user you specified in step 3 and if all went well you’ll connect without having to provide a password.

Safely delete files and folders in terminal


I discovered a useful command line tool today for OSX called trash. It provides all the power of rm but without the ability to blow your leg off as it moves the affected files and folders to the trash rather than permanently deleting them.

There are many on the forums who believe the power of rm is a good thing as it makes you think before hitting enter. You can of course always use the -i option too. Well yes I agree to some extent but we’re all human and I think the purists who hate to see GUI features creeping into the terminal need to take a step back sometimes.

So, easiest way to get it is with homebrew:

brew install trash