Difference between revisions of "Introduction to Linux in HPC/SSH Connections"

From HPC Wiki
Introduction to Linux in HPC/SSH Connections
Jump to navigation Jump to search
m (Tweak page sorting)
 
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
[[Category:Tutorials|SSH Connections]]<nowiki />
 +
{{DISPLAYTITLE:SSH Connections}}<nowiki />
 +
{{Syllabus Introduction to Linux}}<nowiki />
 
__TOC__
 
__TOC__
  
{{Infobox table
+
This tutorial introduces SSH (Secure Shell) as a tool to connect to other Linux machines over a network.
| REAL-NAME    = HPC.NRW
+
It is the most common way to connect to and interact with a cluster. A SSH server is expected to be running on the remote computer, while clients for Linux, Mac OS and Windows are available to establish the connection.
| image  =  Hpc.nrw_small.png ‎
+
This tutorials will teach you how to establish a connection and create a key for public key authentication, which is considered to be the most secure option.
| Feldnamehead1 = Other HPC Courses
 
| Feldname2 = GPU      | Daten3 = Introduction to GPU Programming
 
| Feldname3 = GPROF    | Daten4 = [https://hpc-wiki.info/hpc/GPROF_Tutorial Gprof Tutorial]
 
| Feldnamehead2 = Introduction to Linux in HPC
 
| Feldname5 = 1. | Daten6 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/Historical_Background Historical Background]
 
| Feldname6 = 2. | Daten7 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/The_Command_Line The Command Line]
 
| Feldname7 = 3. | Daten8 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/Directory_structure Directory structure]
 
| Feldname8 = 4. | Daten9 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/Files Files]
 
| Feldname9 = 5. | Daten10 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/Text_display_search Text display search]
 
| Feldname10 = 6. | Daten11 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/Processes_and_permissions Processes and permissions]
 
| Feldname11 = 7. | Daten12 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/The_vim_text_editor The vim text editor]
 
| Feldname12 = 8. | Daten13 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/Shell_scripting_environment_variables Shell scripting environment variables]
 
| Feldname13 = 9. | Daten14 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/System_configuration_files System configuration files]
 
| Feldname14 = 10. | Daten15 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/Various_tips Various tips]
 
| Feldname15= 11. | Daten16 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/Beyond_the_cluster Beyond the cluster]
 
| Feldname16= 12. | Daten17 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/Linux_in_HPC Linux in HPC]
 
| Feldname17= 13. | Daten18 = [https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/SSH_Login SSH Login]
 
}}
 
  
 
=== Video === <!--T:5-->
 
=== Video === <!--T:5-->
  
<youtube width="600" height="400" right>IfD9IPixgpo</youtube>
+
<youtube width="600" height="340" right>j0mPVsgMOQk</youtube>
  
 +
([[Media:HPC.NRW_Introduction_to_Linux_in_HPC_12_SSH_Connections.pdf | Slides as pdf]])
  
 
=== Quiz === <!--T:5-->   
 
=== Quiz === <!--T:5-->   
 +
 +
{{hidden begin
 +
|title = What is the correct syntax to open a ssh connection?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+  <code>ssh [options] <username>@<hostname></code> 
 +
||
 +
-  <code>ssh <username>:<hostname> [options]</code>
 +
||
 +
-  <code>ssh [options] <username> <hostname></code>
 +
||
 +
</quiz>
 +
{{hidden end}}
  
  
 
{{hidden begin  
 
{{hidden begin  
|title = 1. Does it cause a security problem to share an SSH public key with your friends?
+
|title = Where is your ssh config stored on Linux?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
-  <code>~/sshconfig</code> 
 +
||
 +
-  <code>~/.config/ssh</code>
 +
||
 +
+  <code>~/.ssh</code>
 +
|| Explanation: This folder contains the public and private keys for public key authentification. In <code>~/.ssh/config</code> you can define shortcuts for common ssh connections and set client configuration options.
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
 
 +
{{hidden begin
 +
|title = What tools help you with creating and installing a ssh key-pair? (on Linux)
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+  <code>ssh-keygen</code> to create the key files and <code>ssh-copy-id</code> to copy it to the remote machine
 +
||
 +
- <code>ssh --keygen</code> to create the key files and <code>ssh --copy-id</code> to copy it to the remote machine
 +
||
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = Does it cause a security problem to share an SSH public key with your friends?
 
}}
 
}}
 
<quiz display=simple>
 
<quiz display=simple>
Line 76: Line 106:
 
}}
 
}}
  
{{Warning|mode=warn|text= '''lots of tips are given, no warning.'''}}
+
{{Tutorial Navigation
 
+
| previous = [[Introduction_to_Linux_in_HPC/System_configuration_files  | System configuration files ]]
{{Note|'''Exercises in Terminal: no exercises in this section'''}}
+
| main = [[Introduction_to_Linux_in_HPC | Overview ]]
 
+
| next = [[Introduction_to_Linux_in_HPC/SSH_Graphics_File_Transfer | SSH: Graphics and File Transfer]]
<div style='text-align: left;float:left;width:33%;'>{{Clickable button|[https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC/Linux_in_HPC Previous Page]|color=white}}</div>
+
}}
<div style='text-align: center;float:left;width:33%;'>{{Clickable button|[https://hpc-wiki.info/hpc/Introduction_to_Linux_in_HPC Main Menu Page]|color=white}}</div>
 

Latest revision as of 17:26, 4 December 2020

Tutorial
Title: Introduction to Linux in HPC
Provider: HPC.NRW

Contact: tutorials@hpc.nrw
Type: Multi-part video
Topic Area: HPC Platforms
License: CC-BY-SA
Syllabus

1. Background and History
2. The Command Line
3. Linux Directory Structure
4. Files
5. Text display and search
6. Users and permissions
7. Processes
8. The vim text editor
9. Shell scripting
10. Environment variables
11. System configuration
12. SSH Connections
13. SSH: Graphics and File Transfer
14. Various tips

This tutorial introduces SSH (Secure Shell) as a tool to connect to other Linux machines over a network. It is the most common way to connect to and interact with a cluster. A SSH server is expected to be running on the remote computer, while clients for Linux, Mac OS and Windows are available to establish the connection. This tutorials will teach you how to establish a connection and create a key for public key authentication, which is considered to be the most secure option.

Video

( Slides as pdf)

Quiz

What is the correct syntax to open a ssh connection?

ssh [options] <username>@<hostname>
ssh <username>:<hostname> [options]
ssh [options] <username> <hostname>


Where is your ssh config stored on Linux?

~/sshconfig
~/.config/ssh
~/.ssh


What tools help you with creating and installing a ssh key-pair? (on Linux)

ssh-keygen to create the key files and ssh-copy-id to copy it to the remote machine
ssh --keygen to create the key files and ssh --copy-id to copy it to the remote machine

Does it cause a security problem to share an SSH public key with your friends?

Yes
No


Which authentication for SSH login is more secure?

password authentication
public key authentication


When generating the SSH public/private key pair, is it secure to use empty passphrase?

Yes
No


Info:  Verify the fingerprint of remote host, before the first login.
User the SSH public key authentication for login.
Never use an empty passphrase for the SSH keys.
Use strong passphrase to generate the SSH keys.
Keep your private SSH key as top secret.
Create, configure and use different SSH keys for different remote hosts.
If no X11 application is required, disable X11 forwarding. Otherwise, only enable the untrusted X11 forwarding.


<< System configuration files

Overview

SSH: Graphics and File Transfer >>