> ## Documentation Index
> Fetch the complete documentation index at: https://docs.edisglobal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SCP on Linux connects to Linux Server

> Securely copy files between Linux servers with the SCP command. Step-by-step guide using SSH, key authentication, and recursive directory transfers.

## Secure copy files between Linux and Linux servers

SCP (Secure Copy Protocol) is a simple and secure way to transfer files between your Linux machine and a Linux server. This article explains how to use the `scp` command in the Linux terminal to copy files to and from a Linux server.

***

## Step 1: Ensure SSH is Enabled on the Linux Server

Make sure the SSH service is installed and running on your Linux server. Use the following command:

```bash theme={"system"}
sudo apt-get install openssh-server
```

***

## Step 2: use the `scp` command to transfer files

### Copy a File from Local to Remote Server

To upload a file from your local machine to the Linux server:

```bash theme={"system"}
scp /path/to/local/file username@hostname_or_ip:/path/to/remote/directory
```

* Replace `/path/to/local/file` with the full path to the file on your local machine.

* Replace `username` with your Linux server username.

* Replace `hostname_or_ip` with your server’s IP address or domain name.

* Replace `/path/to/remote/directory` with the target directory on the server.

### Copy a File from Remote Server to Local Machine

To download a file from the Linux server to your local machine:

```bash theme={"system"}
scp username@hostname_or_ip:/path/to/remote/file /path/to/local/directory
```

* Replace `/path/to/remote/file` with the file’s path on the server.

* Replace `/path/to/local/directory` with the target directory on your local machine.

***

## Example Commands

### Upload Example

```bash theme={"system"}
scp ~/Documents/example.txt user@192.168.1.10:/home/user/uploads
```

### Download Example

```bash theme={"system"}
scp user@192.168.1.10:/home/user/uploads/example.txt ~/Downloads
```
