Skip to main content

How do I SSH on Mac?

Instructions on how to SSH to a server on Mac.

In the examples here we are setting up the ssh connection to the server mercury.ucdavis.edu. We are also using the ssh key stored at ~/.ssh/mercury you can change these to match the server and key you are using.

  1. Launch the Terminal and run the following commands:
    cd ~/.ssh
    nano config
    
  2. It should now take you to a text editor in your terminal. Type the following:
    Remember to change the username to your username for mercury and the IdentityFile to your private key
    Host mercury.ucdavis.edu
        User username
        IdentityFile ~/.ssh/mercury
    
  3. Press Control + X and follow the on screen instructions to save your file

You have now set up your ssh connection.

You can ssh to the server by running ssh your.server.name in the terminal:
For example:

ssh mercury.ucdavis.edu