Child pages
  • Accessing HPC clusters from Linux / Mac
Skip to end of metadata
Go to start of metadata

  

Setting up your workstation for SSH tunneling will make logging in and transferring files significantly easier, and installing and running an X server will allow you to use graphical software on the HPC clusters. X server is a software package that draws on your local screen windows created on a remote computer (such as an NYU HPC).

Linux users have X set up already. Mac users can download and install XQuartz.

Setting up a tunnel you can reuse (the best approach)

To avoid repeatedly setting up a tunnel, we write the details of the tunnel into your SSH configuration file. The process is the same for Linux and Mac. This is found in the hidden ".ssh/" directory under your home directory. To access it, first open a Terminal window. To see the contents of a directory, enter "ls -la" at the command prompt. The "a" is important, without it files and directories starting with "." will be hidden. We are looking for a directory called ".ssh".

If you do not have a ".ssh" directory, create one as follows. The permissions of this directory are important, hence the chmod command.

mkdir ~/.ssh

chmod 700 ~/.ssh

 

 

Using your favorite editor, open the file ".ssh/config". If you are not familiar with Unix-ish editors, we have some help here.

 Add the following lines to .ssh/config:

# first we create the tunnel, with instructions to pass incoming
# packets on ports 8024, 8025 and 8026 through it and to specific
# locations
Host hpcgwtunnel
   HostName gw.hpc.nyu.edu
   ForwardX11 no
   LocalForward 8025 dumbo.hpc.nyu.edu:22
   LocalForward 8026 prince.hpc.nyu.edu:22
   User NetID 
# next we create an alias for incoming packets on the port. The
# alias corresponds to where the tunnel forwards these packets
Host dumbo
  HostName localhost
  Port 8025
  ForwardX11 yes
  User NetID

Host prince
  HostName localhost
  Port 8026
  ForwardX11 yes
  User NetID

 

Starting the tunnel

To create the tunnel, ssh to it with the following command:

$ ssh hpcgwtunnel

Important: you must leave this window open for the tunnel to remain open. It is best to start a new terminal window for subsequent logins. 

Logging in via the tunnel 

  1. Open a new terminal window

  2. Use ssh to log in to the cluster, as shown below. Note that you must use the short name defined above in your .ssh/config file, not the fully qualified domain name

    $ ssh -Y prince

Creating a once-off tunnel (not the best approach) 

You can set up a once-off tunnel without editing .ssh/config by running the following command:

$ ssh -L 8026:prince:22 NetID@gw.hpc.nyu.edu

This is the equivalent to running "ssh hpcgwtunnel" in the reusable tunnel instructions, but the port forwarding is specified on the command line.

Logging in via a once-off tunnel

However this does not create the convenient alias, so when connecting with ssh, or scp or rsync, you must explicitly connect to that port on your workstation (localhost):

  1. Open a new terminal window

  2. Use ssh to log in to the cluster by logging into to "localhost" on the appropriate port, as shown below.

    $ ssh -Y -p 8026 NetID@localhost

 

  • No labels