Knowledge Bank
  • My GitBook
  • Miscellaneous
  • Project
    • Rider and Intellij
    • Code
    • Frontend
      • Condition
      • AddConditionModalDialog
    • Backend
    • e2e
      • fragments
  • JAVASCRIPT
    • Promise
    • Destructuring
    • Spread Syntax and Rest Parameters
    • Typescript
      • Examples of Types
      • React Typescript
    • This
    • Dot Notation vs Bracket Notation
    • Shallow vs Deep Clone
    • New ES Edition
  • C#
    • Project Note
    • Basic
    • Shortcut and Debugging
  • Programming Paradigms
    • SOLID Principles
    • Object Oriented Programming (OOP)
      • Evolution of OOP (Procedural to OOP)
      • Instantiation
      • 4 Pillars of OOP
      • Extra
    • Functional Programming (FP)
      • Idempotent
      • Imperative vs Declarative
      • Immutability
      • High Order Function and Closure
      • Currying
      • Partial Application
      • Memoization and Caching
      • Compose and Pipe
      • Extra
      • Example of FP
    • OOP vs FP
      • Composition vs Inheritance
  • DATA STRUCTURE
    • Big O
    • Data Structure
    • Array
    • Hash Table
    • Linked List
    • Queue and Stack
    • Tree
      • Binary Heap
      • Trie
    • Graph
      • Example of Graph
  • React-Redux
    • MobX
    • Best Practices
  • Algorithms
    • Recursion
      • Examples of Recursion
    • Sorting
    • Searching and Traversal
    • Dynamic Programming
  • REFACTORING
    • Clean Code
      • Formatting
      • Error Handling
      • Concurrency
      • Testing
      • SOLID Principles
      • Classes
      • Objects and Data Structures
      • Variables
      • Functions
    • Code Smells
      • Long Function
      • Duplicate Code
      • Loops
      • Double Negative
      • Christmas Tree Code
      • Complex Condition
      • Primitive Obsession
      • Speculative Generality
      • God Class
      • Long Parameter List
  • Junior to Senior
    • AWS
      • Lambda
    • Session + Authentication
    • Redis
    • Kubernetes
      • Networking
      • Services
      • Deployment
      • Replica Set
      • YAML
      • pod-definition.yml
      • Kubectl
      • Pods
      • Fundamentals
    • Docker
      • Operating System - Extra
      • Dockerfile - Docker Image
      • Docker Storage
      • Docker Network
      • Docker Registry
      • Docker Command
      • Docker Compose
      • Docker Compose - Postgres
    • Security
      • Logging
      • HTTPS, Cross-Site-Scripting (XSS) and Cross-Site-Request-Forgery (CSRF)
      • 3rd Party Library
      • Injection
      • Code Secret, Secure Header, Access Control, Data Management, Authentication
    • CI/CD
    • SPA vs Server-Side Rendering
    • Performance
      • Optimized Code
      • Critical Render Path
      • Backend Optimization
      • Minimized Files and Images
      • Minimized Delivery
  • SECURITY
    • Encryption
    • SSH
  • Command
  • Cheatsheet
    • NPM
    • GIT
  • Writing Template
    • Guide
    • API
    • ChangeLog
    • FAQ
  • Linux
Powered by GitBook
On this page

Was this helpful?

  1. SECURITY

SSH

Secure Shell

It is a protocol, similar to HTTPS, and it is a way for machines to communicate with one another.

Three uses cases are SSH to Github, remote computer and server.

The advantage of SSH is the use of encryption to ensure secure transfer of information between host and client. Host refers to the remote server you are trying to access and client is the the computer you are using to access the host

The foundation of SSH are

  1. Diffie-Hellman Key Exchange - used only to share public key

  2. Arrive at symmetric key and use this for communication because it is faster than asymmetric encryption

  3. Hashing to make sure no message is tampered

  4. Authentication using password or get authenticated using RSA which allows us to provide the identity of a person without a password.

SSH commands:

Open Gitbash and enter into shell

$ cd ~/.ssh

Create a new SSH key, using the provided email as a a label

$ ssh-keygen -t rsa -b 4096 -C "your_email@email.com"

You will be prompted to create a key and you may create different key for different platform. Passphrase is optional.

Enter file in which to save the key (/c/Users/Your_Name/.ssh/id_rsa):
/c/Users/Your_Name/.ssh/id_rsa_github

Start up the SSH-Agent and add RSA key to the SSH-Agent every time you start the terminal because it won't save them after you close the terminal

$ eval $(ssh-agent -s)

Add your SSH private key to the SSH-Agent

$ ssh-add ~/.ssh/id_rsa_github

To check and delete identities associated with the SSH-Agent

$ ssh-add -l  => List all identity
$ ssh-add -D  => Delete all identity

Add SSH key to the github account, under "Setting => SSH and GPG keys"

$ clip < ~/.ssh/id_rsa_github

Testing your SSH connection

$ ssh - T git@github.com

PreviousEncryptionNextCommand

Last updated 4 years ago

Was this helpful?