How to connect to a remote Linux machine via SSH

It is common practice to connect to remote Linux machines using the command line. This is very useful in the context of server administration and high perfomance computing. X11 forwarding can be enabled for remote tasks that require a graphical user interface.

Outline

  • Open a terminal client
  • Establish an SSH connection
  • Optional: Setup X11 forwarding
  • Related: Improve your life with SSH config
  • More: SSH documentation

Requirements

  • Remote host address
  • Account on remote machine

Jargon

Link to Jargon page with terms: SSH, SSH client, remote host/machine, X11, X11 forwarding, high performance computing, server, server administration

Open a terminal client

The method you use to create an SSH connection depends on your operating system.

Windows

Windows doesn’t have a native SSH client. We recommend downloading MobaXterm. MobaXterm provides all the basic tools for remote computing on Windows.

Note: If you are unable to install software on your computer, choose the executable version.

Mac OS / Linux

Use the Terminal program. This is usually found under Utilities or Accessories.

Establish an SSH connection

  1. Open the terminal client
  2. Enter the following into the terminal command line. Replace user and remote.host with your user account on the remote machine and address of the remote host
ssh user@remote.host
  1. Enter your remote account password if prompted
  2. You should now be logged in!

Optional: Setup X11 forwarding

To enable X11 forwarding, use the -Y flag in your ssh command:

ssh -Y user@remote.host

See anthoer recipe

More: SSH documentation

Links to standard documentation and usage of man pages.