Enhanced Storage Management in FileBrowser: Automated User Folder Creation and Script Integration #3290
Replies: 1 comment
-
I've created a bash script that handles the creation of user folders from disk images and updates existing folders without data loss. Here's how it works: Prompt for variablesread -p "Enter the image file path (e.g., /sdb1/SharedData.img): " IMAGE_NAME Check if the folder exists and is not emptyif [ -d "$FOLDER_PATH" ] && [ "$(ls -A $FOLDER_PATH)" ]; then Mount the image to the folderecho "Mounting the image to $FOLDER_PATH..." Update /etc/fstab for persistent mountingecho "Updating /etc/fstab for persistent mounting..." Set permissions on the folderecho "Setting folder permissions..." Verify the mountecho "Verifying the mount..." Move files back to the main folder from the temp folder and remove the temp folderif [ -d "${FOLDER_PATH}_tem" ] && [ "$(ls -A ${FOLDER_PATH}_tem)" ]; then echo "Setup complete. The folder $FOLDER_PATH is now limited to 5GB."` |
Beta Was this translation helpful? Give feedback.
-
Context:
I have my home server, which is essentially my laptop, and I want to provide additional storage space to friends and family members. However, I need to set limitations on the amount of storage each user can access. For example, I want to allocate 10GB to each user initially, but I also want the flexibility to adjust this allocation for specific users based on their needs.
Problem:
While I manually created a folder from an image file to allocate 10GB of storage to each user, I'm unsure how to automate this process. I need a solution that automatically creates a folder with the specified size (e.g., 10GB) whenever a new user account is created on the server. Additionally, I need the ability to adjust the allocated storage for individual users as necessary.
Furthermore, I seek the capability to upload a bash script, which will execute automatically after creating the user folder, providing me with enhanced customization options.
Proposed Solution:
1. Automatic Folder Creation:
Develop a script or integration that automatically creates a folder with the desired size (e.g., 10GB) whenever a new user account is created on the server.
Ensure that the script is triggered upon user registration or account creation to automate the process.
2. Flexible Storage Allocation:
Implement functionality that allows the administrator (you) to adjust the allocated storage space for individual users.
Provide an interface in the admin panel where you can modify the storage allocation for each user as needed.
3. Script Integration:
Enable the ability to upload a bash script through the admin panel.
Implement a mechanism to automatically execute the uploaded script after creating the user folder, providing enhanced customization options.
Example Implementation:
Develop a bash script that generates folders of specified sizes and includes any additional customization required.
Integrate the script upload feature into the admin panel, allowing you to upload and manage custom scripts.
Configure the system to execute the uploaded script automatically after creating the user folder, enabling you to execute custom actions or configurations tailored to your specific needs.
Beta Was this translation helpful? Give feedback.
All reactions