[[PageOutline]] = Terminals and Shells = [[Image(univac_1965_2.jpg, center, 20%)]] ''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'' [[Image(utilities_terminal.png​, center, 30%)]] 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. [[Image(terminal.png​, center, 30%)]] == 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'' [[Image(ubuntu_terminal.png, center,30%)]] [[Image(terminal2.png, center,30%)]] == Windows "Terminal" (Command Prompt) == === Windows 10 === For the following, open a terminal window by locating the Windows search box in the task bar at the bottom of the screen and entering the command '''cmd'''. || [[Image(WindowsSearchBox.png, center, 50%)]]||[[Image(WindowsCommandPrompt.png, center, 50%)]] || Check that ssh is installed by entering the following command. {{{ where ssh }}} If your result is the message "INFO: Could not find files for the given pattern(s).", then you can install OpenSSH with !PowerShell and proceed below. See [[https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse | Install OpenSSH]]. ==== Recent Windows 10: confirm ssh, scp ==== For recent versions of Windows 10, in your terminal window type the following command. {{{ ssh -Q kex }}} In order to comply with most recent standard for secure transfer, your result should contain the following entry. (See [[https://tools.ietf.org/id/draft-ietf-curdle-ssh-kex-sha2-09.html | https://tools.ietf.org/id/draft-ietf-curdle-ssh-kex-sha2-09.html]]). {{{ diffie-hellman-group-exchange-sha256 }}} If your terminal satisfies the above, then you may use it to login remotely to Cypress. If your terminal fails to satisfy the above, then proceed below. ==== Earlier Windows 10: Check your build number ==== To find your PC's architecture and Windows build number, open Settings > System > About [[Image(https://docs.microsoft.com/en-us/windows/wsl/media/system.png, center, 800px)]] 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. [[https://wiki.hpc.tulane.edu/trac/wiki/cypress/SshUsage#Windows8|Install 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)''' [[Image(startContextMenu.png, center)]] [[Image(powerShell.png, center, 60%)]] 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. * [[https://www.microsoft.com/store/p/ubuntu/9nblggh4msv6|Ubuntu]] From the distro's page, select "Get" [[Image(https://docs.microsoft.com/en-us/windows/wsl/media/ubuntustore.png, center, 500px)]] 5.Open a command-line window, (search '''cmd''') then type 'bash' [[Image(setWSL.png, center)]] See [[https://docs.microsoft.com/en-us/windows/wsl/install-win10|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 [[https://wiki.hpc.tulane.edu/trac/wiki/cypress/SshUsage#Windows|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 === '''Note for Windows 7:''' 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. For alternatives, see [https://hr.tulane.edu/content/reminder-windows-7-end-life Reminder: Windows 7 End of Life]. As Windows 8 is NOT a Unix based OS, it lacks a native terminal emulator that is capable of providing a Unix shell. This will require a work around. For our requirements, the most common solution is the installation of an open source terminal emulator called PuTTY that supports the communication protocols discussed below. If you are using a Windows machine and you have not already downloaded PuTTY you should do so now. === PuTTY === [[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html|Download PuTTY]] [[http://the.earth.li/~sgtatham/putty/0.62/htmldoc/|PuTTY Manual]] After you've downloaded the PuTTY.exe file, move it to the location you prefer and double click to launch. [[Image(PuTTY_launch.png, center, 30%)]] 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. [[Image(PuTTY.png, center, 30%)]] = 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 and Mac === Users on Mac and Linux workstations have ssh available on the command line. 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: [[Image(host_key.png, center, 30%)]] [[Image(host_key_mac.png, center, 30%)]] 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@cypress1.tulane.edu }}} and entering the password associated with your tulaneID across Tulane resources. [[Image(https://docs.google.com/drawings/d/e/2PACX-1vSlffILDUxxzh_QpD4M7P5-bY_tCkYNjA9xIYWuUUqz_HBBczQ18o5AWA9OZ5_w5Q0bwQJbdgmUCuMJ/pub?w=594&h=209, center)]] == Tunneling X Windows Session via SSH == === Linux and Mac === Users on Mac and Linux workstations have ssh available on the command line. To connect to a remote server with X window tunneling run the following: {{{ user@localhost> ssh -Y remoteusername@remotehost.example.com }}} For Mac users, you may have to install [https://www.xquartz.org/ XQuartz]. === Windows === Windows users will need to download an X window server/client software. [[https://sourceforge.net/projects/xming/files/Xming/|Xming]] [[https://sourceforge.net/projects/vcxsrv/|VcXsrv]] [[http://www.cygwin.com/|Cygwin]] [[Image(puttyX11.png, center, 30%)]] With PuTTY, enable X11 forwarding. = 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@tulane.edu and someone will assist you. We will return to SSH shortly, but first we need to discuss [[cypress/BasicLinuxComands|Basic Linux Commands]]. [[cypress/BasicLinuxComands|Next Section: Linux Commands]]