Problem with these instructions? Please send a CFDDFC Support Query.

Command line

Once an instance is launched, the user can access it securely using SSH (Secure Shell) using the key pair created previously. The standard access is remote login from a command line using the OpenSSH client, known as “ssh”. On Linux and macOS systems, ssh is available in the command line “shell” or “terminal”.

MS Windows 10 provides ssh in the following environments. On the native cmd and powershell, ssh may need to be activated.

  • A Linux terminal within the Windows Subsystem for Linux (recommended).
  • cmd command line, which is opened by typing Windows key+R to open the “Run” box, entering “cmd” and then clicking “OK” (or using one of 9 other different ways).
  • Powershell, opened by typing Windows key+R to open the “Run” box, entering “powershell” and then clicking “OK” (or using one of 8 other different ways).

Older versions of MS Windows rely on a separate application PuTTy to provide SSH access, but since older versions are unsupported, we will not document PuTTy here.

Terminal login with SSH

To login using ssh you will need:

  • username ubuntu;
  • IP address or hostname of the instance, e.g. 123.45.67.89;
  • path and file name of the key file, e.g. ~/.ssh/awskey.pem on Linux/macOS, or C:\Users\john\awskey.pem on Windows 10.

The login command has the general form:

ssh -i <path_and_key_file> <user>@<ip_host>

For example, on Linux and macOS, or in Windows using the subsystem for Linux using example IP address and key file above, the command is:

ssh -i ~/.ssh/awskey.pem ubuntu@123.45.67.89

The user should see the login screen for CFD Direct From the Cloud, followed by the command prompt. To logout, type “exit”.

In a Linux/UNIX shell, one option to simplify the command is to define shell variables for the key file and IP as shell variables, e.g. key and ip, respectively by the following:

key=~/.ssh/awskey.pem
ip=123.45.67.89

The login command can then be:

ssh -i "$key" ubuntu@$ip

Using SSH agent

The user can avoid supplying the key file in the login command by using the ssh-agent — OpenSSH’s authentication agent. The agent holds private keys which can be automatically used for authentication. It is available for all platforms but documented here only for Linux/UNIX shell.  Alternatively there are instructions for SSH agent from Windows 10 command line.

The user can add their key to the agent by the command:

ssh-add ~/.ssh/awskey.pem

If this command returns a message “unable to start ssh-agent service”, Linux/UNIX shell users should activate the ssh-agent server by typing:

eval $(ssh-agent)

Once the key is added, users can login without providing the key in the command by:

ssh ubuntu@$ip

The stored keys can be listed by the command:

ssh-add -l

Authentications can fail if the number of keys exceeds the limit on authentication attempts set by the SSH server on the instance (typically 6). When this occurs, it is advisable to empty the agent of stored keys by typing:

ssh-add -D

Further Information: connect using Windows Subsystem for Linux.

Next Step → Using OpenFOAM on an Instance