Seafile File Sync and Share Installation
Seafile is a high-performance self-hosted file synchronization and sharing platform that provides Dropbox-like functionality on your own Linux server, with end-to-end encryption, versioning, and WebDAV support. Unlike other sync tools, Seafile uses a library-based storage model that optimizes sync speed and supports large numbers of files efficiently, making it suitable for teams and enterprises running on VPS or bare-metal infrastructure.
Prerequisites
- Ubuntu 20.04+, Debian 11+, or CentOS/Rocky 8+
- Docker and Docker Compose installed
- Minimum 2 GB RAM
- Root or sudo access
- A domain name with DNS configured
Installing Seafile with Docker
# Create Seafile directory structure
sudo mkdir -p /opt/seafile/{data,shared}
cd /opt/seafile
# Create docker-compose.yml
sudo tee /opt/seafile/docker-compose.yml <<'EOF'
version: '3.8'
services:
db:
image: mariadb:10.11
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=rootpassword # Change this!
- MYSQL_LOG_CONSOLE=true
- MARIADB_AUTO_UPGRADE=1
volumes:
- /opt/seafile/db:/var/lib/mysql
memcached:
image: memcached:1.6.29
restart: unless-stopped
entrypoint: memcached -m 256
seafile:
image: seafileltd/seafile-mc:11.0-latest
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- /opt/seafile/shared:/shared
environment:
- DB_HOST=db
- DB_ROOT_PASSWD=rootpassword # Change this!
- [email protected]
- SEAFILE_ADMIN_PASSWORD=admin-password # Change this!
- SEAFILE_SERVER_LETSENCRYPT=true
- SEAFILE_SERVER_HOSTNAME=seafile.example.com
- TIME_ZONE=America/New_York
depends_on:
- db
- memcached
EOF
# Start Seafile
sudo docker compose up -d
# Monitor first-run setup (takes 2-3 minutes)
sudo docker compose logs -f seafile
Initial Configuration
Access Seahub (web interface):
Navigate to https://seafile.example.com and log in with the admin credentials set in docker-compose.yml.
Configure Seafile settings:
# The main config file
sudo nano /opt/seafile/shared/seafile/conf/seahub_settings.py
# seahub_settings.py — key settings
# Email configuration
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.example.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'smtp-password'
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = '[email protected]'
SERVER_EMAIL = '[email protected]'
# File size limits
MAX_UPLOAD_SIZE = 1073741824 # 1 GB in bytes
SESSION_COOKIE_AGE = 86400 # 1 day session
# Registration control
ENABLE_SIGNUP = False # Disable public registration
ACTIVATE_AFTER_REGISTRATION = False
# Sharing settings
SHARE_LINK_EXPIRE_DAYS_DEFAULT = 7
SHARE_LINK_LOGIN_REQUIRED = False
# Restart Seafile to apply changes
sudo docker compose restart seafile
Client Configuration
Install the Seafile desktop client:
# Ubuntu/Debian
sudo apt install -y apt-transport-https
echo "deb [arch=amd64] https://linux-clients.seafile.com/seafile-client/focal stable main" | \
sudo tee /etc/apt/sources.list.d/seafile.list
sudo apt update && sudo apt install -y seafile-gui
# CentOS/Rocky
sudo dnf install -y seafile
# Or download from https://www.seafile.com/download/
Connect the desktop client:
- Open the Seafile client
- Click Add an account
- Enter server URL:
https://seafile.example.com - Enter username and password
- Choose libraries to sync
Seafile CLI client for servers:
# Install CLI client
sudo apt install -y seafile-cli
# Initialize
seafile-cli init -d /opt/seafile-client
# Start the daemon
seafile-cli start
# Login
seafile-cli config -u [email protected] -l https://seafile.example.com
# Enter password when prompted
# List available libraries
seafile-cli list
# Sync a library
seafile-cli sync -l LIBRARY-ID -s https://seafile.example.com -d /path/to/local/folder
Encryption and Security
Client-side library encryption (end-to-end):
- In Seahub, click + New Library
- Enable Encrypt this library
- Set an encryption password — this password is never sent to the server
- All files in this library are encrypted before upload
# Encrypted libraries cannot be indexed or searched server-side
# The encryption key is derived from the password using PBKDF2
# To verify encryption is active on an existing library:
# Library > Settings > Encrypted: Yes
Server-side security configuration:
# In seahub_settings.py:
# Force HTTPS
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
# Password policy
USER_PASSWORD_MIN_LENGTH = 12
USER_PASSWORD_STRENGTH_LEVEL = 3 # Require mixed case, numbers, symbols
# Login attempt limiting
LOGIN_ATTEMPT_LIMIT = 5
LOGIN_LOCKOUT_TIME = 600 # 10 minutes
WebDAV Configuration
Seafile supports WebDAV for mapping libraries as network drives:
# In seafdav.conf
sudo nano /opt/seafile/shared/seafile/conf/seafdav.conf
[WEBDAV]
enabled = true
port = 8080
fastcgi = false
share_name = /dav
# Restart to enable WebDAV
sudo docker compose restart seafile
# Access WebDAV
# URL: https://seafile.example.com/dav/
# Username: [email protected]
# Password: your-password
# Mount with davfs2 on Linux
sudo apt install -y davfs2
sudo mount -t davfs https://seafile.example.com/dav/ /mnt/seafile/
Windows network drive:
Map https://seafile.example.com/dav/ as a network drive in Windows Explorer.
File Versioning
Seafile keeps snapshots of libraries, enabling file recovery:
# Configure version retention in seafile.conf
sudo nano /opt/seafile/shared/seafile/conf/seafile.conf
[library_trash]
# Days to keep deleted files (0 = forever)
expire_days = 30
[quota]
# Storage quota per user (MB, 0 = unlimited)
default = 5000
Recover files via web UI:
- Open the library in Seahub
- Click the history icon (clock) on a file or folder
- Browse snapshots by date
- Click Restore to recover a previous version
LDAP Integration
Connect Seafile to Active Directory or OpenLDAP:
# In seahub_settings.py, add LDAP settings:
ENABLE_LDAP = True
LDAP_SERVER_URL = 'ldap://ldap.example.com'
LDAP_BASE_DN = 'ou=users,dc=example,dc=com'
LDAP_ADMIN_DN = 'cn=admin,dc=example,dc=com'
LDAP_ADMIN_PASSWORD = 'ldap-admin-password'
LDAP_USER_ATTRIBUTE_MAP = {'name': 'displayName', 'contact_email': 'mail'}
LDAP_LOGIN_ATTR = 'uid' # or 'mail' for email login
LDAP_FILTER = '(objectClass=person)'
# Test LDAP connection
sudo docker compose exec seafile \
python3 /opt/seafile/seafile-server-latest/seahub/manage.py \
ldap_user_info -e [email protected]
sudo docker compose restart seafile
Troubleshooting
Cannot connect to Seafile server:
# Check all containers are running
sudo docker compose ps
# View logs
sudo docker compose logs seafile -n 100
# Check Nginx inside the container
sudo docker compose exec seafile nginx -t
sudo docker compose exec seafile supervisorctl status
Client sync stuck:
# Check sync status in desktop client
# Click the Seafile icon in the system tray > View unsyncable files
# Check sync logs
# ~/.ccnet/logs/seafile.log (Linux)
# ~/Library/Application Support/seafile/logs/ (macOS)
# Restart the sync client daemon
seafile-cli stop && seafile-cli start
"Internal Server Error" in Seahub:
# Check Seahub logs
sudo docker compose exec seafile \
tail -f /shared/logs/seahub.log
# Check for database connection issues
sudo docker compose exec db \
mysql -u root -prootpassword -e "SHOW DATABASES;"
Conclusion
Seafile delivers enterprise-grade file synchronization with client-side encryption, WebDAV support, and robust versioning on self-hosted infrastructure — providing a genuine Dropbox alternative that keeps your data entirely under your control. The library-based storage model and binary diff sync algorithm make it particularly efficient for large collections of files, while LDAP integration enables seamless deployment in organizations with existing directory services.


