|
| 1 | +# User Management |
| 2 | + |
| 3 | +All user management operations can be performed via the `lfss-user` command. |
| 4 | +Using `-h` or `--help` flag will show the help message with all available subcommands and options: |
| 5 | +```bash |
| 6 | +> lfss-user -h |
| 7 | +usage: lfss-user [-h] {add,add-virtual,delete,set,list,set-peer,set-expire} ... |
| 8 | + |
| 9 | +positional arguments: |
| 10 | + {add,add-virtual,delete,set,list,set-peer,set-expire} |
| 11 | + add Add a new user |
| 12 | + add-virtual Add a virtual (hidden) user, username will be prefixed with '.v-' |
| 13 | + set Set user properties, refer to 'add' subcommand for details on each argument |
| 14 | + list List specified users, or detailed info with -l |
| 15 | + set-peer Set peer user relationship |
| 16 | + set-expire Set or clear user expire time |
| 17 | +``` |
| 18 | + |
| 19 | +Most of the commands are self-explanatory, |
| 20 | +and the details flags of each command can be found by using the `-h` flag after the subcommand. |
| 21 | + |
| 22 | +**Below are some extra explanations for a few commands.** |
| 23 | + |
| 24 | +## Check user details |
| 25 | +Besides listing all users, |
| 26 | +to check the details of the user(s), you can also use the `list` subcommand with the `-l/--long` flag, |
| 27 | +followed by one or more usernames. For example: |
| 28 | +```bash |
| 29 | +> lfss-user list -l alice |
| 30 | +User alice (id=20, admin=0, created at 2025-11-13 03:15:09, last active at 2025-11-13 03:15:09, storage=1.00G, permission=UNSET) |
| 31 | +- Credential: d9cf3312d1da59721fd28a5d3075c65b858a373d37e479c2defd6bfeee207677 |
| 32 | +- Storage: 0B / 1.00G |
| 33 | +- Expire: never |
| 34 | +- Peers [READ]: bob, carol |
| 35 | +- Peers [WRITE]: dave |
| 36 | +``` |
| 37 | + |
| 38 | +## Delete user |
| 39 | +To delete a user, you can use the `delete` subcommand. |
| 40 | +```bash |
| 41 | +> lfss-user delete alice |
| 42 | +``` |
| 43 | + |
| 44 | +Note: there are a few clean up operations that need to be done when deleting a user, |
| 45 | +so the deletion process may take some time depending on the number of files owned by the user, |
| 46 | +and because this process is transactional, it may block the system for a short period. |
| 47 | + |
| 48 | +Specifically, user deletion involves: |
| 49 | +- Remove user record from the database. |
| 50 | +- Remove all files under the user's path. |
| 51 | +- Transfer ownership of all files owned by the user under other users' paths to the path owner. |
| 52 | + |
| 53 | +If any of the above steps fail |
| 54 | +(for example, the path owner has insufficient storage space to take over the ownership), |
| 55 | +the deletion process will be rolled back to ensure data consistency. |
0 commit comments