Mac - Logging into HPC with ssh

The objective of this tutorial is to show how to login to the HPC services that ARCC provides. Generally speaking all of our HPC services support login via ssh protocol and the focus of this page. We also provide links to other pages that are specific to different Operating Systems that users may have.

This is a comprehensive guide, feel free to use the Table of Contents below and jump to the sections that are relevant to your use case or current step in your workflow.

Contents

Expected Outcomes

By the end of this tutorial you will know what ssh protocol is and how to use it via a terminal on our Mac system.


Introduction

When a user first gets an account to our HPC services they receive an automatically generated email from arcc-admin@uwyo.edu that includes a line similar to this:

“You will access the cluster via SSH using the command syntax ‘ssh arcc-t01@teton.arcc.uwyo.edu’ from a Linux/Unix/MacOS system.”

The Secure Shell Protocol (ssh) is a cryptographic network protocol for operating network services securely over an unsecured network. Typical applications include remote command-line, login, and remote command execution, but any network service can be secured with ssh. The ssh protocol provides a secure channel over an unsecured network by using a client–server architecture, connecting an ssh client application with an ssh server. The standard port for ssh is 22. It is generally used to access Unix-like operating systems, but it can also be used on Microsoft Windows. Windows 10 uses OpenSSH as its default ssh client and ssh server. The encryption used by ssh is intended to provide confidentiality and integrity of data over an unsecured network, such as the Internet. From Wikipedia.

 


Step-By-Step Tutorial

Opening a Terminal

Since ssh is typically a command line tool, we must first open a terminal on our Mac system to use it. There are multiple ways of doing this here are a few of them on a Mac system:

  1. When the Spotlight Search bar pops up on your screen, type “terminal.app” and hit Return.

    Or you can click the Terminal.app icon that appears.

    Terminal will launch, and you’ll be ready to go.

  2. You can also open Terminal quickly from Launchpad. If you have Launchpad in your dock, click the rocket ship icon—or press “F4” on your keyboard to launch it.

    When Launchpad opens, type “Terminal” and hit return. Or you can click the “Terminal” icon.

    The terminal app will open.

  3. If you’d prefer to go launch Terminal from the program icon in Finder, you’ll usually find it located in the /Applications/Utilities folder. This is its default location on fresh installations of macOS.

    To open Terminal from your Applications folder, click your desktop to bring Finder into focus. In the menu bar, click “Go” and select “Applications.”

    Your Applications folder will open. Scroll through until you find the “Utilities” folder. Double-click the “Utilities” folder to open it. Inside, you will find Terminal.

    Double-click the Terminal.app icon and the Terminal will open.

  4. After launching Terminal, if you’d like to quickly access it again in the future, you can choose to keep its icon in your Dock. Just right-click the Terminal icon on your Dock and select “Options > Keep in Dock.” The next time you need to run Terminal, just click its Dock icon

Using the ssh command

There are several different parts of the ssh command but it can be broke down into username, the '@' symbol, and servername. For example, when I first open a terminal on a Mac computer I see:

arccs-air:~ arcc$

Where arcc is my username on my local system and the arccs-air tells me the name of the system. The other parts indicate what directory I am currently in where the ~ symbol indicates that I am in my home directory and the $ symbol means I am logged in as a regular user on my local system. From here we can now type in our ssh command from the email:

arccs-air:~ arcc$ ssh arcc-t01@teton.arcc.uwyo.edu

Where this is saying that I want to ssh as the user arcc-t01 onto the server @teton.arcc.uwyo.edu. If we then hit ‘enter’ on the first time trying to connect we will get message saying the ‘authenticity of the host … can’t be established' and then asks if we ‘are sure we want to continue?’

There are some sensitive information was blocked out in the above image. If yours doesn’t look the exact same it is normal.

If we then type ‘yes’ we get taken to a pre-authentication window in our terminal where it says ‘this system requires two-factor authentication’ and that we will need to enter our password and second factor token to login.

If you are unsure how to do this, please see our Tutorial on Using Two-Factor Authentication. After we enter our password and 2FA, we are logged into the system successfully and our prompt in our terminal changes to what we used in our ssh command.

You won’t see any dots in the terminal window as you type your password. This is normal, please hit ‘return’ after you finish typing your password & 2FA.

Where arcc-t01 is our username and @tlog1 is the server we logged into. ‘tlog1’ is specifically one of the login nodes on the cluster host teton.arcc.uwyo.edu.

[arcc-t01@tlog1 ~]$

Now you can use the the HPC system the way you expect provided this works with your intended workflow.

Enabling X11 Forwarding in ssh for Graphical Applications

To use graphical applications on the remote system you will need to enable X11 forwarding. To do this with ssh we need to make sure we have XQuartz working. The XQuartz project is an open-source effort to develop a version of the X.Org X Window System that runs on macOS. Together with supporting libraries and applications, it forms the X11.app that Apple shipped with OS X versions 10.5 through 10.7.

Looking at the options we can find we can use a capital 'Y' flag -Y for secure X11 forwarding with XQuartz. See the example below:


Summary

In this tutorial we covered several topics:

  • What is ssh

  • How to open a terminal on Mac

  • How to use ssh in the terminal

  • How to enable X11 with ssh for graphical applications


Next Steps

The next next steps could be varied depending on your workflow. Please see other tutorials for more on different topics.