> ## 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.

# SFTP on Linux connects to Linux Server

> Transfer files between Linux servers using SFTP over SSH. Step-by-step guide covering connection setup, common SFTP commands, and authentication options.

## Secure file transfer between Linux and Linux servers

SFTP (Secure File Transfer Protocol) is a secure way to transfer files between your Linux machine and a Linux server. This article explains how to use the `sftp` command in the Linux terminal to copy files securely.

***

## Step 1: Ensure SSH is Enabled on your 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 `sftp` command to transfer files

### Connect to the Server

To start an SFTP session, use the following command:

```bash theme={"system"}
sftp username@hostname_or_ip
```

* Replace `username` with your Linux server username.

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

### Transfer files using SFTP commands

Once connected, you can use the following commands to transfer files:

* **Download a file from the server**:

* **Upload a file to the server**:

* **List files in the remote directory**:

* **Change the remote directory**:

* **Exit the SFTP session**:

***

## Example Commands

### Upload Example

```bash theme={"system"}
put ~/Documents/example.txt /home/user/uploads
```

### Download Example

```bash theme={"system"}
get /home/user/uploads/example.txt ~/Downloads
```

***
