Documentation Index
Fetch the complete documentation index at: https://docs.ahmadraza.in/llms.txt
Use this file to discover all available pages before exploring further.
Comprehensive Guide to SSH and SCP
Table of Contents
Introduction
SSH (Secure Shell) and SCP (Secure Copy Protocol) are essential tools for secure remote access and file transfers over a network. This guide provides detailed instructions on how to install, set up, and use SSH and SCP.Installing SSH and SCP
Ubuntu/Debian
CentOS/RHEL
Fedora
Using SSH
Connecting to a Remote Server
To connect to a remote server using SSH:username with your actual username and remote_host with the IP address or domain name of the remote server.
Running Commands on a Remote Server
To run a command on a remote server without logging in:Using SSH Keys for Authentication
Generate an SSH key pair on your local machine:SSH Configuration File
You can simplify SSH commands by creating an SSH configuration file (~/.ssh/config):
Tunneling with SSH
To create an SSH tunnel for secure port forwarding:local_port with the port on your local machine and remote_port with the port on the remote machine.
Using SCP
Copying Files from Local to Remote
To copy files from your local machine to a remote server:Copying Files from Remote to Local
To copy files from a remote server to your local machine:Copying Directories Recursively
To copy directories recursively, use the-r option:
Common SSH and SCP Options
SSH Options
-p port: Specify the port to connect to on the remote host.-i identity_file: Specify the identity file (private key) to use for authentication.-L local_port:localhost:remote_port: Create an SSH tunnel.-X: Enable X11 forwarding.-C: Enable compression.
SCP Options
-P port: Specify the port to connect to on the remote host.-i identity_file: Specify the identity file (private key) to use for authentication.-r: Copy directories recursively.-C: Enable compression.
