Deployment guide

elFinder 2.1.70 web file manager

Overview

elFinder is an open-source web file manager with a desktop-style interface: a folder tree on the left and your files on the right. From the browser you can upload by drag and drop, use right-click menus, preview images, text and PDF files with quick look, search, copy, cut and paste, rename, duplicate, create and extract zip archives, and resize and rotate images.

This guide covers launching and using the elFinder 2.1.70 Web File Manager on Ubuntu 24.04 AMI from SecureAnyCloud on Amazon EC2. The image locks elFinder down so that you can reach it safely from the first boot. It is one version of the SecureAnyCloud file sharing and sync listing on AWS Marketplace, and you choose it as the software version when you subscribe and launch.

What you get:

  • HTTPS from the first boot. nginx serves elFinder on port 443 with a certificate generated on your instance's first boot. Port 80 redirects to HTTPS, and requests for a host name that the instance does not serve are dropped.
  • A sign-in on everything, with a password unique to your instance. HTTP Basic authentication protects the whole application: the page, its scripts and the PHP connector that performs every file operation. The image ships with no password at all. First boot generates one (stored as a bcrypt hash) and writes it to /root/elfinder-credentials.txt (root only). The site is not served until that has happened.
  • Uploads can never run. Your files live on a dedicated data volume, outside the web server's document root, and are returned only through the signed-in connector. The web server cannot read them directly. PHP files, shell scripts and executables are refused on upload, by type and by name, including inside zip archives that you extract.
  • No network features. elFinder can mount remote storage (FTP, Dropbox, Google Drive and others) and fetch files from a URL that you paste. On this image those features are removed or switched off, and PHP is blocked at the kernel level from opening any network connection except to the instance itself. The file manager can therefore never be used to reach other servers or the EC2 instance metadata service.
  • Cross-site requests are refused. Browsers resend a Basic sign-in automatically, so another website could otherwise make your browser delete or rename files. Every file operation refuses a request that does not come from the file manager's own page, and elFinder 2.1.70 adds its own per-session token on top.
  • Fully patched Ubuntu 24.04 LTS at build time, PHP 8.3 with the latest security fixes, and unattended security upgrades switched on.

What is on the image: elFinder 2.1.70 (BSD-3-Clause) with jQuery 4.0.0 and jQuery UI 1.14.2 served from the instance, PHP 8.3 (FPM), nginx, Ubuntu 24.04 LTS, cloud-init and the AWS Systems Manager agent. The licences and exact sources are in /usr/share/doc/elfinder/.

Default user: ubuntu | Architecture: x86_64 | Recommended instance type: m5.large

Prerequisites

  • An AWS account subscribed to the listing, an EC2 key pair and a VPC subnet.
  • A security group that allows TCP 22 (SSH), TCP 443 (the file manager) and TCP 80 (redirects to HTTPS) from your own networks only.
1

Launch the instance

In the AWS Marketplace listing, choose Continue to Subscribe, then Continue to Configuration. Select elFinder 2.1.70 Web File Manager on Ubuntu 24.04 as the software version, select your Region, and choose Launch through EC2. Pick m5.large, your key pair, a security group as described above, and a subnet.

The AMI includes an 8 GiB root volume and a separate 20 GiB data volume that holds your files. Raise the data volume under Configure storage if you need more space. You can also grow it later (see Step 9).

To launch with the AWS CLI instead, replace the values in angle brackets. This command sets the data volume to 100 GiB:

aws ec2 run-instances --region <region> --image-id <ami-id-from-the-listing> \
  --instance-type m5.large --key-name <your-key-pair> \
  --security-group-ids <your-security-group> --subnet-id <your-subnet> \
  --metadata-options HttpTokens=required,HttpEndpoint=enabled \
  --block-device-mappings 'DeviceName=/dev/sdf,Ebs={VolumeSize=100,VolumeType=gp3}' \
  --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=elfinder}]'
2

Connect to your instance

Connect to elFinder 2.1.70 Web File Manager on Ubuntu 24.04 as the SSH user ubuntu, with the key pair you chose at launch:

ssh -i <your-key.pem> ubuntu@<public-ip>
3

Check the services

First boot generates the certificate and the password, and then starts the site. This takes a few seconds:

systemctl is-active elfinder-host elfinder-firstboot php8.3-fpm nginx
active active active active

Only SSH (22) and nginx (80, 443) listen on the network. PHP talks to nginx over a local socket, and the two loopback entries are Ubuntu's local DNS resolver:

sudo ss -lntp | awk 'NR>1 {print $4}' | sort -u
0.0.0.0:22 0.0.0.0:443 0.0.0.0:80 127.0.0.53%lo:53 127.0.0.54:53 [::]:22 [::]:443 [::]:80

The health helper checks that the site answers and that it demands a sign-in:

sudo /usr/local/sbin/elfinder-health
PRIMARY_HEALTH_OK https://ec2-203-0-113-10.compute-1.amazonaws.com/ (healthz 200, UI 401 without credentials)

If nginx is not running, first boot has not finished, or it failed, in which case the site is never served. Check systemctl status elfinder-host elfinder-firstboot and journalctl -u elfinder-firstboot.

4

Get your URL and password

sudo cat /root/elfinder-credentials.txt

Only root can read this file. It holds the address and this instance's sign-in:

# elFinder 2.1.70 Web File Manager - generated on first boot by elfinder-firstboot.service
# This password is unique to this instance; none was baked into the image. Keep this file secret. ELFINDER_URL=https://ec2-203-0-113-10.compute-1.amazonaws.com/ ELFINDER_ADMIN_USER=admin ELFINDER_ADMIN_PASSWORD=<ELFINDER_ADMIN_PASSWORD> ...

You can confirm the sign-in from the instance itself. The helper checks the redirect, confirms that an unauthenticated request is refused, confirms that the password opens the page and the connector, and confirms that a wrong password and common defaults are refused:

sudo /usr/local/sbin/elfinder-cred-roundtrip
OK https 301 + unauthenticated 401 + admin opens UI and connector (API 2.1070) + wrong and default passwords refused

The connector reports elFinder's API version, 2.1070 for elFinder 2.1.70.

5

Sign in

Open the ELFINDER_URL address in your browser. The certificate is self-signed until you install your own (Step 8), so the browser asks you to accept it once. Compare the fingerprint that the browser shows with the one on the instance:

sudo openssl x509 -in /etc/nginx/ssl/elfinder.crt -noout -fingerprint -sha256

Sign in as admin with the password from Step 4. The file manager opens on the Files volume, which starts with a few sample files that you can delete:

Change the password to one of your own at any time (16 to 128 characters, no spaces). The helper reads the new password from standard input, so it never appears in your shell history or the process list, and it updates the credentials file:

sudo elfinder-set-password --stdin

Run sudo elfinder-set-password without --stdin to generate a new random password instead. Your browser then asks you to sign in again.

6

Manage your files

Drag files from your desktop into the window to upload them, or use the upload button in the toolbar. Double-click a folder to open it. Select a file and press Space for a quick look:

Right-click a file or folder to see every action: open, download, preview, copy, cut, duplicate, delete, rename, resize and rotate an image, create a zip archive or extract one, and get info:

Keep the following in mind:

  • Archives are zip. PHP itself creates and extracts archives, so zip is the only format available. When an archive holds a PHP file, script or executable, those items are refused and the rest is extracted.
  • Refused uploads. PHP files (.php, .phtml, .phar and similar), shell, Perl and Python scripts, .htaccess / .user.ini files and executables are refused. Every other type uploads normally, up to 2 GB per file (large files go up in chunks).
  • Web pages download. HTML and SVG files are offered as downloads rather than opened in the browser, so a page that you store cannot run as part of the file manager.
  • No URL upload or network drives. This image does not support pasting a web address to fetch a file, or mounting FTP, SFTP or cloud storage.
  • Direct links. A download link copied into a new browser tab's address bar is refused because it carries no proof that it came from the file manager page. Use the Download action instead.
7

Where your files live

Your files are in /var/lib/elfinder/files on the data volume, owned by the unprivileged elfinder account that PHP runs as:

sudo ls -la /var/lib/elfinder/files

To copy files in or out over SSH, write them as that account so the file manager can manage them, for example:

sudo -u elfinder cp /home/ubuntu/report.pdf /var/lib/elfinder/files/Documents/
8

Use your own host name and certificate

Point a DNS record at the instance (an Elastic IP keeps the address across stop and start), and then tell the instance its name. This creates a new self-signed certificate for that name, updates the nginx host rule, the cross-site guard and the address in the credentials file, and keeps the name across reboots:

sudo elfinder-set-hostname files.example.com

To use a certificate from a public authority instead, replace /etc/nginx/ssl/elfinder.crt (full chain) and /etc/nginx/ssl/elfinder.key (mode 0600, owned by root) with your own, and then run sudo systemctl reload nginx. Running elfinder-set-hostname again later replaces them with a new self-signed pair. Basic authentication sends the password with every request, so keep the site on HTTPS.

9

Check persistence, storage and updates

Every service is enabled, so elFinder returns after a reboot or a stop and start, and your files and the password stay as they are. Unattended security upgrades keep the operating system, PHP and nginx patched:

systemctl is-enabled nginx php8.3-fpm unattended-upgrades
enabled enabled enabled

The data volume is mounted by its file system UUID. To grow it, enlarge the EBS volume in the EC2 console and then extend the file system online:

sudo resize2fs $(findmnt -no SOURCE /var/lib/elfinder)

To back up your files, take an EBS snapshot of the data volume, or use AWS Backup on the instance. elFinder itself is the release from the project's GitHub repository, and SecureAnyCloud publishes a new version of the image when a newer elFinder release is available.

Security notes

  • No shared secret ships in the image. No password, password hash, TLS key or credentials file exists until your instance's first boot generates them, and nginx refuses to start until that has finished.
  • Fail-closed start. If first boot cannot complete, nothing is served. The PHP connector also refuses to work if it is ever reached without a signed-in user.
  • PHP is confined. It runs as the elfinder account, can write only the file tree and its own working folder, cannot run other programs, cannot open URLs and cannot connect anywhere except the instance itself. The code of the file manager is owned by root and is read-only to PHP. Sessions are kept in memory, never on disk.
  • Metadata service blocked. nginx, PHP and the first-boot step that writes your password are blocked from the EC2 instance metadata service. Only the step that looks up the instance's public name uses it (IMDSv2).
  • Security fixes. elFinder 2.1.70 fixes the zip extraction and URL upload issues published with it (GHSA-gxmj-r5rf-ggwq, GHSA-8x3q-jpjh-qh5c) and a CSRF issue in network mounting (GHSA-9hjf-w35w-6vx2). The network mount and URL upload features are switched off here in any case.
  • Restrict the network. Limit 22/tcp to your management network, and limit 80/443 to the networks that use the file manager.

Architecture summary

Component Detail

File manager elFinder 2.1.70 (BSD-3-Clause), code in /var/www/elfinder (root owned), connector php/connector.php

PHP PHP 8.3 FPM, pool elfinder on a unix socket, account elfinder, sessions in /run/elfinder

Web server nginx on 443 (HTTPS, per instance certificate in /etc/nginx/ssl), 80 redirects to HTTPS

Sign in HTTP Basic authentication, user admin, bcrypt hash in /etc/nginx/elfinder.htpasswd

Your files /var/lib/elfinder/files on the 20 GiB data volume (resizable)

Credentials /root/elfinder-credentials.txt, mode 0600, root only

First boot elfinder-host.service (host name and certificate), elfinder-firstboot.service (password)

Tools elfinder-set-password, elfinder-set-hostname, elfinder-cred-roundtrip, elfinder-health

Ports 22 SSH, 80 redirect, 443 file manager

Base image Ubuntu 24.04 LTS, fully patched, unattended security upgrades enabled, IMDSv2 required

Support

SecureAnyCloud images come with 24/7 support. Email sales@secureanycloud.com with your AWS account ID and the instance ID. For questions about elFinder itself, see the elFinder project on GitHub.

elFinder is an open source project of Studio 42. SecureAnyCloud is not affiliated with or endorsed by the elFinder project or Studio 42.

Deploy on AWS

Launch elFinder 2.1.70 Web File Manager on Ubuntu 24.04 on AWS with 24/7 support from SecureAnyCloud.

View on Marketplace

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on AWS