SSH Tutorial - Connecting to Linux Servers via SSH
Introduction
Whats is SSH
What You Need
- A computer with an SSH client (Windows, macOS, Linux)
- A remote machine running an SSH server (Linux server, Raspberry Pi, cloud VM)
Connecting to a Remote Server
Basic SSH command:
ssh username@server-ip [-p cust-port]
Running Remote Commands
Run a single remote command:
ssh user@host "ls -la /tmp"
Setting Up Passwordless SSH
ssh-keygen -t ed25519
Copy key to server:
ssh-copy-id user@server-ip
Test login:
ssh user@server-ip
Useful SSH Options
- -p : custom port
- -i : specify key
- -L : port forwarding
- -Y / -X : graphical forwarding