filebrowser: replace manage_users.sh with additional_directories.sh

Symlinks don't work for giving scoped FileBrowser users access to extra
folders — FileBrowser's afero.BasePathFs blocks symlinks that resolve
outside the user's scope directory.

Switch to bind-mount approach: additional_directories.sh edits
docker-compose.yml to add real bind-mount entries for each extra folder,
so FileBrowser sees them as actual subdirectories within the user's root.
No symlinks, no scope-boundary issues.

Features:
- Reads FB_PATH from .env to list available source folders on the host
- Parses docker-compose.yml to show what's already configured per user
- Adds/removes volume entries with a timestamped backup before each edit
- Prompts to restart the container after changes
- Normalises scope paths from the API (handles missing leading slash)

manage_users.sh removed — user CRUD is handled by the FileBrowser web UI.

https://claude.ai/code/session_014CCYqVwW6d6f5dw1qRokYt
This commit is contained in:
Claude
2026-06-08 03:29:36 +00:00
parent c72a20af42
commit 412560aa8f
3 changed files with 354 additions and 282 deletions
+13 -6
View File
@@ -222,14 +222,14 @@ FB_SETTINGS
chown -R "$ACTUAL_USER:$ACTUAL_USER" "$FB_DIR"
# Deploy user-management helper script
# Deploy extra-directory helper script
local _TOOLS_DIR
_TOOLS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../tools" 2>/dev/null && pwd)" || true
if [ -f "$_TOOLS_DIR/manage_users.sh" ]; then
cp "$_TOOLS_DIR/manage_users.sh" "$FB_DIR/manage_users.sh"
chmod 750 "$FB_DIR/manage_users.sh"
chown "$ACTUAL_USER:$ACTUAL_USER" "$FB_DIR/manage_users.sh"
log_success "manage_users.sh installed at $FB_DIR/manage_users.sh"
if [ -f "$_TOOLS_DIR/additional_directories.sh" ]; then
cp "$_TOOLS_DIR/additional_directories.sh" "$FB_DIR/additional_directories.sh"
chmod 750 "$FB_DIR/additional_directories.sh"
chown "$ACTUAL_USER:$ACTUAL_USER" "$FB_DIR/additional_directories.sh"
log_success "additional_directories.sh installed at $FB_DIR/additional_directories.sh"
fi
echo ""
@@ -254,6 +254,13 @@ Web-based file manager. Browse, upload, and download files through a browser.
- Database: ./database/filebrowser.db
- Settings: ./config/settings.json
## Users
Create and manage users in the FileBrowser web UI.
To give a user access to extra folders beyond their root directory:
\`\`\`
$FB_DIR/additional_directories.sh
\`\`\`
## Manage
\`\`\`
cd $FB_DIR