---
title: "Deploy via SFTP & GitHub Actions CI/CD"
description: "Connect to Hosted EZ over SFTP with SSH public keys or passwords, and automate continuous deployments from GitHub Actions for static sites, Laravel, and PHP apps."
---

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

# Deploy via SFTP & GitHub Actions CI/CD

Every Hosted EZ site—including **Static Sites**, **WordPress**, **Laravel**, **Drupal**, **Nextcloud**, and **Custom PHP**—includes hardened SFTP access at **`sftp.hostedez.com:22`**. Because Hosted EZ does not require a repository webhook UI, **SFTP + SSH public keys** is the recommended path for automated CI/CD deployments from GitHub Actions, GitLab CI, or your local terminal.

## SFTP connection details

Open **Site → SFTP** in [app.hostedez.com](https://app.hostedez.com/dashboard) to view your connection parameters and manage credentials:

- **Host**: `sftp.hostedez.com`
- **Port**: `22`
- **Username**: `sftp_<siteSlug>` (exact value shown in the **SFTP connection** card)
- **Authentication**: OpenSSH public keys (up to **25 keys per site**) and/or a one-time generated 24-character password.
- **Remote web directory**: `/public_html` (for Laravel, web traffic serves `/public_html/public`; for Drupal, `/public_html/web`).

> **SFTP-only endpoint (no SSH shell or rsync over SSH)**
>
> `sftp.hostedez.com:22` strictly enforces the **SFTP subsystem only**. Interactive SSH logins, remote `exec`, and `rsync -e ssh` are intentionally rejected.
> - To transfer files from the CLI or CI, use **`lftp`** (supports recursive `mirror -R --delete`), **`sftp`**, or **`scp`** (OpenSSH 9+ uses SFTP mode by default).
> - To run CLI commands (`wp`, `artisan`, `composer`, `drush`, `occ`), use the [Browser Terminal](/deploy/file-manager-and-terminal) or the [Hosted EZ MCP Server](/automation/mcp-server).

## 1. Generate and add an SSH key

Generate a dedicated Ed25519 deploy key locally (leave the passphrase empty if the key will be used by an unattended CI runner):

```bash
ssh-keygen -t ed25519 -C "hostedez-ci" -f ~/.ssh/hostedez_deploy -N ""
cat ~/.ssh/hostedez_deploy.pub
```

In **Site → SFTP**, click **Add SSH key**, enter a descriptive label (for example, `GitHub Actions — main` or `MacBook Pro`), paste the single-line `.pub` key, and save.

**Supported key types**: `ssh-ed25519`, `ssh-rsa` (minimum `2048` bits), `ecdsa-sha2-nistp256`, `ecdsa-sha2-nistp384`, `ecdsa-sha2-nistp521`, `sk-ssh-ed25519@openssh.com`, and `sk-ecdsa-sha2-nistp256@openssh.com`. Never paste a private key.

## 2. Connect from your terminal or GUI client

### lftp (mirror & sync)

`lftp` mirrors an entire build folder over SFTP and deletes removed files cleanly:

```bash
lftp -u sftp_my-site, sftp://sftp.hostedez.com:22 -e "
  set sftp:connect-program 'ssh -a -x -i ~/.ssh/hostedez_deploy -o IdentitiesOnly=yes'
  mirror -R --delete --verbose --parallel=4 dist/ public_html/
  quit
"
```
### OpenSSH sftp

```bash
sftp -i ~/.ssh/hostedez_deploy -o IdentitiesOnly=yes -P 22 sftp_my-site@sftp.hostedez.com
```

Inside the SFTP prompt:

```text
sftp> cd public_html
sftp> put -r dist/* .
sftp> ls -la
sftp> bye
```
### FileZilla / Cyberduck / Transmit

1. Protocol: **SFTP — SSH File Transfer Protocol**
2. Host: `sftp.hostedez.com`, Port: `22`
3. User: `sftp_<siteSlug>`
4. Authentication: **Key file** (select `~/.ssh/hostedez_deploy`) or **Password** (click **Generate password** in **Site → SFTP**; the password is shown once).
5. Open `public_html/` to upload or edit your website files.

## 3. GitHub Actions CI/CD workflows

Store these two repository secrets in **GitHub → Settings → Secrets and variables → Actions**:

- `HOSTEDEZ_SFTP_USER`: your site's SFTP username (for example, `sftp_acme-docs`)
- `HOSTEDEZ_SFTP_KEY`: the full contents of your private key (`~/.ssh/hostedez_deploy`)

### Static Site (Vite / Astro / Next.js)

```yaml title=".github/workflows/deploy-static.yml"
name: Deploy Static Site to Hosted EZ

on:
  push:
    branches: [main]
  workflow_dispatch:

concurrency:
  group: deploy-hostedez
  cancel-in-progress: false

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm

      - name: Install and build
        run: |
          npm ci
          npm run build

      - name: Install lftp
        run: sudo apt-get update && sudo apt-get install -y lftp

      - name: Sync dist/ to Hosted EZ via SFTP
        env:
          SFTP_USER: ${{ secrets.HOSTEDEZ_SFTP_USER }}
          SFTP_KEY: ${{ secrets.HOSTEDEZ_SFTP_KEY }}
        run: |
          install -m 600 /dev/null "$RUNNER_TEMP/sftp_key"
          printf '%s\n' "$SFTP_KEY" > "$RUNNER_TEMP/sftp_key"
          lftp -u "$SFTP_USER," sftp://sftp.hostedez.com:22 <<EOF
          set sftp:connect-program "ssh -a -x -i $RUNNER_TEMP/sftp_key -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new"
          set net:max-retries 3
          set net:reconnect-interval-base 5
          mirror -R --delete --verbose --parallel=4 dist/ public_html/
          quit
          EOF
```

Change `dist/` to `out/` for Next.js static export or `public/` for Hugo.
### Laravel / Custom PHP

```yaml title=".github/workflows/deploy-laravel.yml"
name: Deploy Laravel to Hosted EZ

on:
  push:
    branches: [main]
  workflow_dispatch:

concurrency:
  group: deploy-laravel
  cancel-in-progress: false

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: shivammathur/setup-php@v2
        with:
          php-version: "8.5"
          tools: composer:v2

      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm

      - name: Install PHP & frontend assets
        run: |
          composer install --no-dev --optimize-autoloader --no-interaction
          npm ci
          npm run build

      - name: Install lftp
        run: sudo apt-get update && sudo apt-get install -y lftp

      - name: Sync application to Hosted EZ via SFTP
        env:
          SFTP_USER: ${{ secrets.HOSTEDEZ_SFTP_USER }}
          SFTP_KEY: ${{ secrets.HOSTEDEZ_SFTP_KEY }}
        run: |
          install -m 600 /dev/null "$RUNNER_TEMP/sftp_key"
          printf '%s\n' "$SFTP_KEY" > "$RUNNER_TEMP/sftp_key"
          lftp -u "$SFTP_USER," sftp://sftp.hostedez.com:22 <<EOF
          set sftp:connect-program "ssh -a -x -i $RUNNER_TEMP/sftp_key -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new"
          set net:max-retries 3
          mirror -R --delete --verbose --parallel=4 \
            --exclude-glob .git/ \
            --exclude-glob .github/ \
            --exclude-glob node_modules/ \
            --exclude-glob .env \
            --exclude-glob storage/ \
            --exclude-glob public/storage \
            ./ public_html/
          quit
          EOF
```

Notice `--exclude-glob .env`, `--exclude-glob storage/`, and `--exclude-glob public/storage` so CI never overwrites your server `.env` or uploaded user files, and never attempts to upload the `public/storage` symlink. After schema changes, run `artisan migrate --force && artisan optimize` in the **Browser Terminal**.

## SFTP security & permission enforcement

Hosted EZ's SFTP gateway enforces these rules automatically on every connection:

- **Strict confinement**: Each credential is chrooted to its own site directory; path traversal outside the site root is blocked at the kernel level.
- **No symlinks or hardlinks**: Creating symlinks or hardlinks over SFTP is refused.
- **Automatic permissions**: Sensitive files (`.php`, `wp-config.php`, `.env`, `.htpasswd`) are set to `0600`, all other regular files to `0640`, and directories to `0750`.
- **Quota enforcement**: Uploads stop immediately if your account's NVMe SSD storage quota is reached.
- **Rotating credentials**: Click **Rotate password** in **Site → SFTP** to invalidate the previous password immediately, or click **Delete** next to any SSH key to revoke it.

Source: https://docs.hostedez.com/deploy/sftp-and-github-actions/index.mdx
