# SFTPGo Installation & Setup **Date**: 2026-05-15 **Version**: 2.6.7 (source build from main branch) **Status**: Active --- ## Top Info | Field | Value | |-------|-------| | **Source** | `https://github.com/drakkan/sftpgo.git` (main branch, ~2.7.99-dev) | | **Source archive** | `release/system/v1.0/services/src/sftpgo-main.tar.gz` (9.2MB) | | **Source SHA256** | `6607334148917dd80a687706a3ae63ea8c532d10c6717c87491da23939c96d4a` | | **Build method** | `git clone && go build -o /Users/accusys/bin/sftpgo .` | | **Binary** | `/Users/accusys/bin/sftpgo` (88MB) | | **Binary SHA256** | `9991d2a1c877d5bcae17cb4e026de939862e4b880924589cf4ed15ac7291ec7e` | | **Config** | `/Users/accusys/momentry/etc/sftpgo/sftpgo.json` | | **Templates** | `/Users/accusys/momentry/etc/sftpgo/templates/` (copied from source) | | **Database** | PostgreSQL `sftpgo` database, user `sftpgo` | | **Plist** | `momentry_runtime/plist/com.momentry.sftpgo.plist` | | **Ports** | 8080 (HTTP/WebAdmin), 2022 (SFTP), 8090 (WebDAV) | | **Resource ID** | `sftpgo` in `dev.resources` (type: `system_tool`, category: `file_upload`) | --- ## Build from Source ### Prerequisites - Go 1.26+ (`go version`) ### Build ```bash # Clone source git clone --depth 1 https://github.com/drakkan/sftpgo.git /tmp/sftpgo # Build binary cd /tmp/sftpgo go build -o /Users/accusys/bin/sftpgo . # Verify /Users/accusys/bin/sftpgo --version ``` ### Archive Source ```bash tar czf release/system/v1.0/services/src/sftpgo-main.tar.gz -C /tmp sftpgo/ shasum -a 256 release/system/v1.0/services/src/sftpgo-main.tar.gz ``` --- ## Database Setup ```bash # Create database and user psql -U accusys -h /tmp -d postgres -c "CREATE DATABASE sftpgo" psql -U accusys -h /tmp -d postgres -c "CREATE USER sftpgo WITH PASSWORD 'sftpgo_pass_2026'" psql -U accusys -h /tmp -d sftpgo -c "GRANT ALL ON SCHEMA public TO sftpgo" ``` --- ## Start Server ### Initialize Provider (first time only) ```bash SFTPGO_DEFAULT_ADMIN_USERNAME=admin \ SFTPGO_DEFAULT_ADMIN_PASSWORD=Test3200Test3200 \ /Users/accusys/bin/sftpgo initprovider \ -c /Users/accusys/momentry/etc/sftpgo/ ``` ### Start Serve ```bash SFTPGO_DEFAULT_ADMIN_USERNAME=admin \ SFTPGO_DEFAULT_ADMIN_PASSWORD=Test3200Test3200 \ nohup /Users/accusys/bin/sftpgo serve \ -c /Users/accusys/momentry/etc/sftpgo/ \ > /Users/accusys/momentry/log/sftpgo.log 2>&1 & ``` Note: The `-c` flag must point to the config directory (containing `sftpgo.json`, `templates/`, `static/`, `openapi/`). ### Verify ```bash # Health check (HTTP 200 = running) curl -s http://127.0.0.1:8080/api/v2/status # Should return: {"error":"no token found","message":"Unauthorized"} # Get admin token curl -s -u "admin:Test3200Test3200" "http://127.0.0.1:8080/api/v2/token" ``` --- ## User Management ### Get Admin Token The SFTPGo API uses JWT tokens. All user/management API calls require `Authorization: Bearer ` header. ```bash TOKEN=$(curl -s -u "admin:Test3200Test3200" \ "http://127.0.0.1:8080/api/v2/token" | \ python3 -c "import json,sys;print(json.load(sys.stdin).get('access_token',''))") ``` ### Create Demo User ```bash curl -s -X POST "http://127.0.0.1:8080/api/v2/users" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "username": "demo", "password": "demopassword123", "home_dir": "/Users/accusys/momentry/var/sftpgo/data/demo", "permissions": {"/": ["*"]}, "status": 1, "quota_size": 0, "quota_files": 0 }' ``` ### Update User Password ```bash # Get current user data USER_DATA=$(curl -s "http://127.0.0.1:8080/api/v2/users" \ -H "Authorization: Bearer $TOKEN" | \ python3 -c " import json,sys users=json.load(sys.stdin) u=[u for u in users if u['username']=='demo'][0] u['password']='newpassword' print(json.dumps(u)) ") # Update user curl -s -X PUT "http://127.0.0.1:8080/api/v2/users" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d "$USER_DATA" ``` ### List Users ```bash curl -s "http://127.0.0.1:8080/api/v2/users" \ -H "Authorization: Bearer $TOKEN" ``` --- ## Configuration Key settings in `/Users/accusys/momentry/etc/sftpgo/sftpgo.json`: | Section | Key | Value | Note | |---------|-----|-------|------| | `data_provider` | `driver` | `postgresql` | User/auth database | | `data_provider` | `name` | `sftpgo` | Database name | | `data_provider` | `users_base_dir` | `/Users/accusys/momentry/var/sftpgo/data` | Base directory for user homes | | `httpd.bindings[0]` | `port` | `8080` | Web admin + REST API | | `sftpd.bindings[0]` | `port` | `2022` | SFTP server | | `webdavd.bindings[0]` | `port` | `8090` | WebDAV server | | `setup` | `installation_code` | `momentry2026` | Web setup wizard code | --- ## launchd Plist ```xml ProgramArguments /Users/accusys/bin/sftpgo serve -c /Users/accusys/momentry/etc/sftpgo/ ``` Load with launchctl: ```bash launchctl load ~/Library/LaunchAgents/com.momentry.sftpgo.plist ``` --- ## Resource Record ```sql INSERT INTO dev.resources (resource_id, resource_type, category, capabilities, config) VALUES ( 'sftpgo', 'system_tool', 'file_upload', '["sftp", "file_transfer", "webdav"]', '{"binary": "/Users/accusys/bin/sftpgo", "version": "2.6.7", "port": 8080, "source_sha256": "6607334148917dd80a687706a3ae63ea8c532d10c6717c87491da23939c96d4a", "binary_sha256": "9991d2a1c877d5bcae17cb4e026de939862e4b880924589cf4ed15ac7291ec7e", "source_archive": "release/system/v1.0/services/src/sftpgo-main.tar.gz", "plist": "momentry_runtime/plist/com.momentry.sftpgo.plist"}' ) ON CONFLICT (resource_id) DO UPDATE SET resource_type = EXCLUDED.resource_type, category = EXCLUDED.category, config = EXCLUDED.config; ``` --- ## Ports Summary | Port | Service | Purpose | |------|---------|---------| | 8080 | HTTP/HTTPS | Web admin UI + REST API | | 2022 | SFTP | File transfer over SSH | | 8090 | WebDAV | File access via WebDAV | --- ## Credentials | User | Password | Role | |------|----------|------| | `admin` | `Test3200Test3200` | Administrator (API + Web Admin) | | `demo` | `demopassword123` | Demo user (file upload) |