Tuesday, October 6, 2015

SSH Secure Shell

SSH

Telnet lets you control another computer remotely. SSH is a secure telnet. Telnet lets you control another computer remotely.

The computer we want to control must have "SSH Server" installed.

SSH Server

Open SSH Daemon - SSHD is the Server

- Password

- Public/Private Key Pair

- Host Based (file containing known hosts)

 Mac: System Preferences | Sharing | Remote Login

 Unix: sudo apt-get install openssh-server

               Check if it is running:       sudo systemctl status ssh

 Rap Pi: sudo raspi-config

               Interfacing Options | P2 SSH           

Windows 10: Apps & Features | Add Feature | Open SSH

services.msc | OpenSSH SSH Server | Autostart on boot

 Android: Install SimpleSSHD app

 iOS: No option available

Generate Keys

ssh-keygen

~/.ssh/id_rsa (private key)

~/.ssh/id_rsa.pub (public key, goes on the server in the following file)

"authorized_keys" folder (in .ssh/authorized_keys)

Client Computer

To connect:

ssh username@ip_address

(prompts for password if keys are not setup) 

Need to install SSH software 

Mac/Linux/RasPi: Enabled by default 

Windows 10: Apps & Features | Enable OpenSSH Client 

Can also use putty.exe (has GUI)

https://www.putty.org/ 

Android: Install app Termius

Windows

Git Bash (MinGW) provides a Linux-style terminal and includes OpenSSH.

You can download Git for Windows (including Git Bash) here: http://git-scm.com/download/win

Start bash at command-line and issue ssh commands.

ssh -i [pem file] [user]@[hostname]

Changing permission of the pem file (so that ssh allows remote connect). In bash:

chmod 600 [pem file]

References:
  • https://gist.github.com/bradtraversy/f03df587f2323b50beb4250520089a9e
  • https://www.ssh.com/academy/ssh/tunneling