# POST /users/{name}/home-repair

First published 3 Oct 2026 (release 0.1.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the users group.

Repair ownership and permissions in a customer's home

- Who may call it: administrator, reseller
- Token scope, any of: users, all
- Answers: 200 OK

Administrators can repair homes for customers and resellers. Resellers can repair their own customers' homes. The repair sets the home container (/home/USER) to 0755 with root:root ownership and the home directory (/home/USER/files) to 0750 with the account as owner and the web server's group. It sets web/, each site directory and each document root to 0755. It sets tmp/, mail/, non-hidden directories directly under mail/ and .ssh/ to 0700, and .ssh/authorized_keys to 0600.

Below the home directory, the repair restores the account as owner and its primary group as group. The recursive walk changes ownership on symbolic links themselves and skips their targets, device nodes and sockets. When checking standard paths and document roots, UrbeStack follows up to 32 root-owned symbolic links in parent path components and reports links that stand in place of an expected file or directory.

Set modes to true to apply 0755 to directories and 0644 to files under web/ and document roots within the home, clearing setuid and setgid bits. The optional content mode repair excludes mail/ and the home directory's dotfiles.

The response contains home, with the old and new values for the first 1000 changes and the total number of entries affected. Use dry_run to preview the report. The repair has a timeout of 1800 seconds and skips accounts with a missing Linux account or home container. Use urbestack-rebuild to create missing paths.

## As a command

- [urbestack-home-repair](https://urbestack.com/docs/commands/urbestack-home-repair.md): Restores ownership and permissions on existing UrbeStack home paths.

## Parameters

- `name` (path, Username, required)

## Request body

JSON.

- `dry_run` (boolean): Whether to preview the changes without applying them. Defaults to false.
- `modes` (boolean): Whether to also reset content permissions under web/ and document roots within the home. Defaults to false.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X POST "$API/users/alice/home-repair" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "dry_run": true,
    "modes": true
  }'
```

Response, 200 OK:

```
{
  "home": {
    "changed": 1,
    "changes": [
      {
        "from": "text",
        "path": "public_html/index.php",
        "to": "text",
        "what": "mode"
      }
    ],
    "modes": 1,
    "name": "alice",
    "skipped": [
      {
        "path": "public_html/index.php",
        "why": "text"
      }
    ]
  }
}
```

## Errors

- 400: --name and --all exclude each other
- 400: <name> is an administrator, not a customer: administrators have no home
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: One of --name or --all is required
- 400: Username '<value>' is reserved
- 401: Authentication required
- 404: User '<name>' not found
