⚡ 100% In-Browser & Private: Your data never leaves your computer. Powered by Cloudflare Edge CDN.
ProWebTools PRO
Developer & SEO Utilities
25+ Recipes

SSH & Remote Admin Commands Cheat Sheet

The definitive SSH command reference: Ed25519 key generation, ~/.ssh/config shortcuts, local/remote port tunneling, ProxyJump, and rsync sync with 1-click copy.

Key Generation & Security (4 commands)

Key Generation & Security
ssh-keygen -t ed25519 -C "[email protected]"

Generates modern, high-speed, and secure Ed25519 elliptic-curve SSH key pair.

PRO TIP Ed25519 is superior to 4096-bit RSA in both security margin and performance.
Key Generation & Security
ssh-keygen -t rsa -b 4096 -C "[email protected]"

Generates a 4096-bit RSA SSH key pair for legacy systems incompatible with Ed25519.

PRO TIP Never use RSA keys smaller than 3072 or 4096 bits in production.
Key Generation & Security
chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_ed25519 ~/.ssh/authorized_keys

Enforces strict POSIX file permissions required by SSH daemon on keys and directory.

PRO TIP SSH client will refuse to connect with "Permissions are too open" error if permissions exceed 600.
Key Generation & Security
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server_ip

Installs your public key on remote server's authorized_keys file with 1 command.

PRO TIP Enables passwordless, cryptographic public-key authentication.

Connecting & Remote Execution (4 commands)

Connecting & Remote Execution
ssh -i ~/.ssh/custom_key user@server_ip

Connects using an explicit private key identity file.

PRO TIP Useful when managing multiple cloud servers with distinct key pairs.
Connecting & Remote Execution
ssh -p 2222 user@server_ip

Connects to a non-standard SSH port (e.g., 2222 or custom port).

PRO TIP Changing default port 22 reduces automated brute-force bot noise in auth.log.
Connecting & Remote Execution
ssh user@server_ip "sudo systemctl restart nginx"

Executes a single command on remote server and immediately returns output locally.

PRO TIP Executes non-interactively without spawning a full login shell.
Connecting & Remote Execution

ProxyJump: Connects to internal private subnet host through a public bastion host.

PRO TIP Replaces complex netcat ProxyCommand chains with simple -J flag.

SSH Config File (~/.ssh/config) (2 commands)

SSH Config File (~/.ssh/config)
Host prod HostName 198.51.100.10 User ubuntu Port 22 IdentityFile ~/.ssh/id_ed25519 ServerAliveInterval 60

Configures a named alias in ~/.ssh/config for 1-word login (ssh prod).

PRO TIP ServerAliveInterval 60 sends keep-alive packets to prevent firewall timeouts.
SSH Config File (~/.ssh/config)
Host * ControlMaster auto ControlPath ~/.ssh/sockets/%r@%h-%p ControlPersist 600

Multiplexes SSH connections: reuses existing socket for instant secondary logins.

PRO TIP Massively accelerates git commands and Ansible playbooks across SSH.

Port Forwarding & Tunneling (3 commands)

Port Forwarding & Tunneling
ssh -L 8080:localhost:3000 user@server_ip

Local Port Forwarding: Bridges remote server's internal port 3000 to local localhost:8080.

PRO TIP Allows browsing remote staging web apps or databases (Redis, Postgres) securely.
Port Forwarding & Tunneling
ssh -R 9000:localhost:8000 user@server_ip

Remote Port Forwarding: Exposes your local port 8000 onto remote server's port 9000.

PRO TIP Self-hosted alternative to ngrok for testing webhooks on your local machine.
Port Forwarding & Tunneling
ssh -D 1080 -N -f user@server_ip

Dynamic Port Forwarding: Spawns a background SOCKS5 proxy server on localhost:1080.

PRO TIP Configure your browser to use SOCKS5 proxy to route all traffic through remote VPS.

File Transfer (SCP & Rsync) (3 commands)

File Transfer (SCP & Rsync)
scp -P 22 -r ./dist user@server_ip:/var/www/html/

Copies local directory recursively to remote path over encrypted SSH.

PRO TIP For large transfers or syncing, rsync is preferred due to delta transfers and resume.
File Transfer (SCP & Rsync)
rsync -avzP --exclude "node_modules" ./ user@server_ip:/var/www/app/

Synchronizes directory over SSH with archive flags, compression, and progress bar.

PRO TIP -P shows progress and keeps partially transferred files if connection drops.
File Transfer (SCP & Rsync)
ssh user@server_ip "tar czf - /var/log" | tar xzf - -C ./backup_logs

Streams compressed directory archive from remote server directly into local folder.

PRO TIP Zero temporary disk writes on the remote server.

Agent & Troubleshooting (3 commands)

Agent & Troubleshooting
eval "$(ssh-agent -s)" && ssh-add ~/.ssh/id_ed25519

Starts ssh-agent in background and loads private key so you enter passphrase once.

PRO TIP Use ssh-add -l to list currently loaded identities.
Agent & Troubleshooting
ssh -v -i ~/.ssh/key user@server_ip

Enables verbose debug output: prints key negotiation, cipher suites, and auth failures.

PRO TIP Use -vv or -vvv for increasingly detailed debugging trace.
Agent & Troubleshooting
ssh-keygen -R 198.51.100.10

Removes offending host key from ~/.ssh/known_hosts after server rebuild or IP change.

PRO TIP Eliminates the "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!" warning.