Skip to main content

Endpoint

POST /api/servers/:server/files/chmod

Authentication

Requires Bearer token authentication via the Authorization header.

Path Parameters

server
string
required
The UUID of the server

Request Body

root
string
required
The root directory for chmod operations (all paths are relative to this)
files
array
required
Array of file chmod operations

Response

Returns 204 No Content on success.

Example Request

curl -X POST "https://wings.example.com/api/servers/d3aac109-f0fc-4674-b5bc-199bb50e6b88/files/chmod" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "root": "/",
    "files": [
      {"file": "start.sh", "mode": "0755"}
    ]
  }'

Common Permission Modes

ModePermissionDescription
0644-rw-r--r--Standard file (owner read/write, others read)
0755-rwxr-xr-xExecutable file or directory (owner all, others read/execute)
0600-rw-------Private file (owner read/write only)
0700-rwx------Private executable or directory (owner only)
0777-rwxrwxrwxFully accessible (not recommended)

Behavior

  • Operations are performed concurrently for better performance
  • Both files and directories can have permissions changed
  • Mode must be a valid octal string (e.g., “0755”, “0644”)
  • Directories are not processed recursively - only the specified path is modified
  • Symlinks have their target’s permissions modified
  • Path traversal is prevented
For shell scripts and other executables, use mode 0755 to make them executable. For configuration files, use 0644.

Error Responses

Invalid mode format (must be octal string like “0755”)
Missing or invalid Bearer token
Server or file does not exist
Failed to change permissions (permission denied, etc.)

Use Cases

  • Make shell scripts executable
  • Secure configuration files
  • Fix permission issues preventing server startup
  • Set proper permissions after file upload
  • Prepare files for execution

Source Reference

Implementation: router/router_server_files.go (postServerChmodFile function)

Build docs developers (and LLMs) love