Skip to content

Instantly share code, notes, and snippets.

@simplay
Last active November 22, 2016 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simplay/c761d14c5bda691e2282b692e1e964e7 to your computer and use it in GitHub Desktop.
Save simplay/c761d14c5bda691e2282b692e1e964e7 to your computer and use it in GitHub Desktop.
ssh cheatsheet

SSH Cheatsheet

SSH-Client

Generating a new SSH key

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

Adding your SSH key to the ssh-agent

$ eval "$(ssh-agent -s)" $ ssh-add ~/.ssh/id_rsa

Copy the Public Key to Server

$ ssh-copy-id SERVER_USER@SERVER_ADDRESS $ cat ~/.ssh/id_rsa.pub | ssh SERVER_USER@SERVER_ADDRESS "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

SSH Server

Install and run SSH Server

$ sudo apt-get update
$ sudo apt-get install openssh-server
$ sudo systemctl restart ssh

Configuration: Accept ssh connections

Disable the Password for Root Login

  1. $ sudo nano /etc/ssh/sshd_config
  2. $ reload ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment