Updated on 2025-07-10 GMT+08:00

(Advanced) Mounting an SFS File System to Multiple Users

Application Scenario

Storing model files for each user uses too much space. Mount the same SFS file system to users' applications so that they can share model file resources. To avoid inference results of different users from affecting each other, you can change the result save path on the Stable Diffusion WebUI.

Prerequisites

  1. Each user must have the SWR Admin, VPC Administrator, Server Administrator, SFS FullAccess, and SFS Turbo FullAccess permissions in their agencies.
  2. Each user must complete the steps in Deploying and Using the Stable Diffusion Application to create an application.
  3. Each user must use the same SFS file system to initialize the mounted file system of the custom model. For details, see Step 3: Initializing a Custom Model. The sd directory already exists in the mounted SFS file system.

Step 1: Creating a Multi-user Configuration File

This example uses two users user1 and user2. You can add or delete users as required.

  1. Select a user, go to the details page of the Stable Diffusion application whose custom model has been initialized, click Upload Model, and log in to the file system.
  2. Go to the sd directory, as shown in Figure 1.

    Figure 1 Entering the sd directory

  3. As shown in Figure 2, find the config.json file, select it, and copy it to any directory. In this case, the file is still stored in the sd directory and renamed config_user1.json. As shown in Figure 3, copy the file for user2 and rename it config_user2.json.

    Figure 2 Copying the config.json File
    Figure 3 Creating the config_user1.json and config_user2.json files

Step 2: Modifying Environment Variables and Using the New Configuration File

  1. Go to the Stable Diffusion application details page, find the function resource whose logic name is stable_diffusion in the Resource tab, and click the link to go to the function details page.
  2. On the Configuration > Environment Variables tab page, click Edit Environment Variable. In the dialog box that is displayed, click Add. Set the environment variable for user1 based on Table 1 and user2 based on Table 2 and click OK.

    Table 1 Environment variables of the new configuration file used by user1

    Key

    Value

    EXTRA_ARGS

    --ui-settings-file=/mnt/auto/sd/config_user1.json

    Table 2 Environment variables of the new configuration file used by user2

    Key

    Value

    EXTRA_ARGS

    --ui-settings-file=/mnt/auto/sd/config_user2.json

To enable (Advanced) Enabling WebUI Authentication and (Advanced) Accessing Applications Using APIs at the same time, you can set environment variables at the same time. For details, see Table 2.

Step 3: Changing the Result Save Path

After the preceding configurations are complete, the two users can share the model files in the same SFS file system. To further isolate the inference results of different users, you can change the result save path in the settings.