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
(Created page with "__TOC__ === Video === <!--T:5--> <youtube width="600" height="400" right>IfD9IPixgpo</youtube> [https://git-ce.rwth-aachen.de/hpc.nrw/ap2/tutorials/linux/-/blob/master/Slid...")
 
m (Tweak page sorting)
 
(31 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__
 +
 +
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 === <!--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--> 
 +
 
 +
{{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
 +
|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>
 +
{
 +
|type="()"}
 +
-  Yes
 +
||
 +
+  No
 +
|| Explanation: SSH public key authentication uses the asymmetric encryption. Therefore, it's completely safe to share your SSH public key. But you must keep your SSH private key as top secret.
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
 
 +
{{hidden begin
 +
|title = Which authentication for SSH login is more secure?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
-  password authentication
 +
||
 +
+  public key authentication
 +
|| Explanation: The password based authentication may be exposed to the brute-force password attack. Please use the SSH public key authentication.
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
 
 +
{{hidden begin
 +
|title = When generating the SSH public/private key pair, is it secure to use empty passphrase?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
-  Yes
 +
||
 +
+  No
 +
|| Explanation: Please never ever use an empty passphrase for the SSH key pair. Use strong passphrase to generate the SSH key pair.
 +
</quiz>
 +
{{hidden end}}
  
[https://git-ce.rwth-aachen.de/hpc.nrw/ap2/tutorials/linux/-/blob/master/Slides/ssh/openssh.pdf SSH Einloggen]  Slides 3 - 40 (38 pages)
 
  
 +
{{Warning|mode=info|text='''Verify the fingerprint of remote host, before the first login.'''<br>'''User the SSH public key authentication for login.'''<br>'''Never use an empty passphrase for the SSH keys.'''<br>'''Use strong passphrase to generate the SSH keys.'''<br>'''Keep your private SSH key as top secret.'''<br>'''Create, configure and use different SSH keys for different remote hosts.'''<br>  '''If no X11 application is required, disable X11 forwarding. Otherwise, only enable the untrusted X11 forwarding.'''
 +
}}
  
=== Slide Layout === <!--T:5-->
+
{{Tutorial Navigation
 +
| previous = [[Introduction_to_Linux_in_HPC/System_configuration_files  | System configuration files ]]
 +
| main = [[Introduction_to_Linux_in_HPC | Overview ]]
 +
| next = [[Introduction_to_Linux_in_HPC/SSH_Graphics_File_Transfer | SSH: Graphics and File Transfer]]
 +
}}

Latest revision as of 16: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 >>