SSH & Security
How to safely enter a computer that is thousands of miles away.
What is SSH?
SSH (Secure Shell) is a cryptographic network protocol for operating network services securely over an unsecured network.
In simple terms: It creates a secure tunnel between your laptop and the server.
ssh user@192.168.1.50The Key Concept (Pun Intended)
Passwords are weak. Pros use Key Pairs.
Public Key (Lock)
You give this to the server. Anyone can see it. It acts like a logic lock on the server's door.
Private Key (Key)
NEVER SHARE THIS. This stays on your laptop. It is the only thing that can open the lock.
The '0644 are too open' Error
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'server.pem' are too open.
SSH is paranoid. If your private key file is readable by other users on your computer (Permission 0644), it refuses to use it.
The Fix:
chmod 400 server.pem400 = User (Read), Group (None), Others (None).
Connecting to AWS/Server
Once your key permissions are fixed, you connect using the -i (identity) flag.
ssh -i server.pem ubuntu@ip-address