> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# Setting Up Backups via SFTP in DirectAdmin

:::important

This guide is applicable only to our **DirectAdmin VPS plans**. If you have a **DirectAdmin Shared Hosting or Reseller plan**, backups are automatically handled by us.

:::

SFTP (SSH File Transfer Protocol) backups in DirectAdmin provide a secure way to back up your hosting server's data, including websites, databases, and configuration files, to a remote server.

## Requirements

Before proceeding, make sure you have:

- **Root** user access to the DirectAdmin server.
- **Admin** user access to the DirectAdmin panel.

## Configure SFTP Backup Scripts


### Log in to the DirectAdmin server
Log in to your DirectAdmin server using your `root` credentials.
### Navigate to the Custom Scripts directory
Change your current directory to the DirectAdmin Custom Scripts directory:
```bash
cd /usr/local/directadmin/scripts/custom/
```
### Clone the SFTP backup repository
Clone the following GitHub repository:
```bash
git clone https://github.com/poralix/directadmin-sftp-backups.git
```
### Copy the PHP scripts
Copy the required PHP scripts into the Custom Scripts directory:
```bash
cp -f directadmin-sftp-backups/ftp_download.php ./
cp -f directadmin-sftp-backups/ftp_list.php ./
cp -f directadmin-sftp-backups/ftp_upload.php ./
```
### Set file permissions and ownership
Set the required file permissions and change the ownership of the scripts:
```bash
chmod 700 ftp_*.php
chown diradmin:diradmin ftp_*.php
```

## Configure Backups in DirectAdmin


### Log in to DirectAdmin
Log in to the DirectAdmin panel using your **Admin** user credentials.
Navigate to **Admin Tools** → **Admin Backup/Transfer**.
<img alt="Admin Backup/Transfer option" src={image0} />
### Open the backup scheduling page
Click **Schedule** to configure a backup.
<img alt="Schedule backup option" src={image1} />
### Select users to back up
Select **All Users** or choose specific users you want to back up.
Click **Next** to continue.
<img alt="Select users for backup" src={image2} />
### Configure the backup schedule
Choose **Now** to create a one-time backup immediately, or select **Cron Scheduling** to configure recurring backups at a specific time.
<img alt="Configure backup schedule" src={image3} />
### Configure the backup destination
Choose where to store the backup. You can select a local destination or a remote server.
For SFTP backups, select the **FTP** option and enter the destination details:
- **IP:** Remote server IP address.
- **Username:** Remote server username.
- **Password:** Remote server password.
- **Path:** Destination directory on the remote server.
- **SSH Port:** Remote server SSH port.
Make sure to select the **Secure FTP** option.
<img alt="Configure remote SFTP backup destination" src={image4} />
### Select backup data and schedule
Select the data you want to back up. Usually, you can select **All Data**.
Click **Schedule** to save the backup configuration.
<img alt="Select backup data and schedule" src={image5} />

:::tip

For recurring backups, choose a suitable cron schedule and ensure the remote server has sufficient storage space.

:::
