wiki:cypress/SshUsage

Version 56 (modified by fuji, 6 weeks ago) ( diff )

Terminals and Shells

Taken from UNIVAC promotional materials circa 1960

The terminal has been the primary means of interfacing with a cluster computing machine since the 1960s. Today, users who are working on a laptop or desktop with an operating system that is based on Unix will have a useful terminal built into their operating system. This includes anyone using Mac os X or any flavor of Linux.

Mac Terminal

To access the terminal program on a Mac go to

Applications → Utilities → Terminal

This will launch a terminal containing a UNIX shell. The UNIX shell is a command line interpreter which both allows you to pass commands to the operating system and displays output. Currently, the default shell for most unix-based systems is the Bourne Again SHell or bash shell. Your shell can be modified to provide a custom environment and we will go into detail on how to make these modifications in later sessions.

Ubuntu Terminal

In Unity versions of Ubuntu (11.04 and later) the easiest way to access the terminal is through the search function of the dash

Dash → Search for Terminal

finding the ubuntu terminal

ubuntu terminal

Windows "Terminal" (Command Prompt)

Evaluate your ssh installation

For the following, open a terminal window by locating the Windows search box in the taskbar at the bottom of the screen and entering the command cmd.

Windows Search BoxWindows Command Prompt

Check that ssh is installed by entering the command where ssh at the command prompt (user@localhost>) in your terminal window.

user@localhost> where ssh

If ssh is installed, then your result will look like the following.

C:\Users\user\ssh
C:\Windows\System32\OpenSSH\ssh.exe

If per the above you have ssh installed, then you should still test that your version of ssh will work with Cypress, in which case you may still encounter an error. To test your installed ssh with Cypress, see the section Secure SHell (SSH) below.

Otherwise, if you encounter an unsuccessful result (for example if your result for where ssh above is "…Could not find…"), then proceed to the appropriate section below for your version of Windows.

Windows 11

Install OpenSSH

To install OpenSSH, see Install OpenSSH for Windows. Then verify ssh via Evaluate... above for use with Cypress.

Windows 10

Update Options

If your Windows 10 does not have the ssh command or, for example, does not have the proper key exchange method mentioned above, then you can do one of the following.

  1. Download and run Windows 10 Update Assistant and then verify ssh via the above. See Download and run Windows 10 Update Assistant.
  2. See Install OpenSSH above (applies to Windows 10 as well) to install and verify ssh for use with Cypress.
  3. Proceed to the next section Check your OS build number to check your OS build number and, if applicable, install Windows Subsystem for Linux (WSL).
  4. Proceed to the section PuTTY below to install PuTTY.

Check your OS build number

To find your PC's architecture and Windows build number, go to the Windows search box and open Settings > System > About

https://docs.microsoft.com/en-us/windows/wsl/media/system.png

If your windows 10 is newer than build 16215, you can install WSL with the instructions below. If your windows 10 is older than build 16215, you can still use PuTTY.

Installing Windows Subsystem for Linux (WSL)

1.Open PowerShell as Administrator by right-clicking on the start button and selecting the menu item Windows PowerShell (Admin)

Windows10 Start context menu

Windows10 !PowerShell

2.In the resulting window run the command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

3.Restart your computer when prompted.

4.Let's install Ubuntu, click the link below.

From the distro's page, select "Get"

https://docs.microsoft.com/en-us/windows/wsl/media/ubuntustore.png

5.Open a command-line window, (search cmd) then type 'bash'

See Install WSL

X WIndow for Graphics

To run software with graphics with either Windows Terminal or WSL, you have to have X-window client software installed on your Windows. See here.

And you may need to do following on WSL terminal. Under bash command-line window

sudo apt install x11-apps

Add a line below into ~/.bashrc

export DISPLAY=localhost:0.0

Windows 8 (Do Not Use)

As of January 10, 2023, Windows 8.1 has reached the end of support and will no longer receive security updates, non-security updates, bug fixes, technical support, or online technical content updates. Thus your use of Windows 8 represents a security risk. See Windows 8 End of support.

Windows 7 (Do Not Use)

As of January 14, 2020, if you're still using Windows 7, this represents a critical security threat to the university network and user data, and your network access will be restricted to internet traffic only. Thus you'll be prevented from logging in to Cypress. For alternatives, see Reminder: Windows 7 End of Life.

PuTTY

Download PuTTY

PuTTY Manual

After you've downloaded the PuTTY.exe file, move it to the location you prefer and double click to launch.

windows putty launch

To log onto cypress, enter cypress1.tulane.edu (or cypress2.tulane.edu) into the Host Name field and make sure the port is set to 22. Click on Open and you will be given a login window to cypress.

putty screen

Remote Access

A short History

Scientists have been performing computations remotely since 1940 when George Stibitz used a Teletype machine to perform remote computations on a Complex Number Machine in New York City from the an AMS conference held at Dartmouth (http://history-computer.com/Internet/Dreamers/Stibitz.html). By 1973, standards were defined for a set of remote access protocols called Telnet which are still in use today. Subsequently (1983), the Berkley Software Distribution (BSD) Unix operating system instituted an alternative protocol called Remote SHell, or rsh. While still available on most systems, rsh is not recommended for common use as it lacks encryption. In 1995, this lack of security lead a researcher named Tatu Ylonen to invent a secure set of protocols after his University was the victim of a sniffing attack. He named his protocols Secure SHell, or SSH, and this has become the default means of remote access for unix based machines world wide.

Secure SHell (SSH)

Linux, Mac, Windows 10, and WSL

Originally, only users on Mac and Linux workstations had ssh available on the command line. Afterwards, support for ssh was added to Windows 10 - initially via WSL (see WSL above) and then directly from the Windows terminal. To connect to a remote server run the following:

user@localhost> ssh remoteusername@remotehost.example.com

The first time you log into a new machine, you will be asked if you trust the server. For instance, the first time you log into Cypress using PuTTY you will receive the following prompt:

host key alert

host key security for mac

Click on yes (or if using Mac/Linux/Windows/WSL terminal simply type "yes" at the corresponding prompt). You should now be prompted for the password associated with your remote username.

For those who have accounts on Cypress, you can connect to cypress by running the command

user@localhost> ssh tulaneID@cypress.tulane.edu

and, at the prompt for password, entering the password associated with your tulaneID across Tulane resources.

user@localhost> ssh tulaneID@cypress.tulane.edu
tulaneId@cypress.tulane.edu's password: 
Last login: Mon Mar 29 11:14:39 2021 from XXX.XX.XXX.XXX
[tulaneId@cypress1 ~]$ 

After successful login, your current working directory on Cypress will be your home directory denoted by the tilde, ~. (See Storage: home directory.)

https://docs.google.com/drawings/d/e/2PACX-1vSlffILDUxxzh_QpD4M7P5-bY_tCkYNjA9xIYWuUUqz_HBBczQ18o5AWA9OZ5_w5Q0bwQJbdgmUCuMJ/pub

In Case Of Error: Unable to negotiate…no matching host key type found

If you encounter the error below:

user@localhost> $ssh userid@cypress.tulane.edu
Error msg: Unable to negotiate with xx.xx.xx.xx port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

Add the following lines to the file ~/.ssh/config on your local computer.

Host cypress.tulane.edu
        HostName cypress.tulane.edu
        HostKeyAlgorithms=+ssh-rsa,ssh-dss
        PubkeyAcceptedKeyTypes=+ssh-rsa

If the file ~/.ssh/config doesn't exist yet on your local computer, you may need to first create the directory ~/.ssh and then create and edit the file ~/.ssh/config.

Also, be sure to enter exactly the same value for HostName in the file ~/.ssh/config as the hostname that you use in your ssh command.

On Linux, Mac, and WSL, if you prefer, you can do so using the command line in your terminal window via the following.

user@localhost> cd  # change the current directory to your home directory as needed
user@localhost> mkdir -p .ssh # create the subdirectory .ssh as needed
user@localhost> cd .ssh # change to that subdirectory
user@localhost> nano config # create, as needed, and edit and save the file named config.

For file editing with nano, etc., see File Editing Example.

In the case of nano, you can simply copy and paste the contents into the window and save the result.

For Windows terminal, you can open a window for notepad from the command line via the following.

C:\Users\user> cd &rem change directory to your home directory
C:\Users\user> notepad .ssh\config

'notepad' may create .ssh/config.txt. If so, rename it with 'rename' command.

Again, be sure to enter exactly the same value for HostName in the file ~/.ssh/config as the hostname that you use in your ssh command.

ssh Public-key Authentication

Tunneling X Windows Session

Using SSH

The ssh command has a -Y option to support X window tunneling.

To connect to a remote server with X window tunneling run the following:

user@localhost> ssh -Y remoteusername@remotehost.example.com

Mac

For Mac users, you may have to install XQuartz.

Windows

All Windows users - whether using ssh or PuTTY - will need to download and install X window server/client software.

Xming

VcXsrv

Cygwin

X410

Using PuTTY

With PuTTY - in addition to X window server/client software mentioned above, enable X11 forwarding as shown.

Using windows commadline prompt

C:\Users\uid>set DISPLAY=127.0.0.1:0.0
C:\Users\uid>ssh -Y uid@cypress.tulane.edu

CHECKPOINT

For Workshop

Everyone should now have a terminal open and be logged into Cypress. If you are not logged on to Cypress, please raise your hand and someone will assist you.

In General

Once you have a terminal, if you are not logged on to Cypress, please request help via hpcadmin@… and someone will assist you.

We will return to SSH shortly, but first we need to discuss Basic Linux Commands.

Next Section: Linux Commands

Attachments (15)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.