Skip to content

PAIInstallWizard.ts sets improper permissions on all files in ~/.claude on at least Linux #484

Description

@vpzed

PAIInstallWizard.ts contains a fixPermissions function which runs

  try {
    // Step 1: chmod first - make files accessible
    execSync(`chmod -R 755 "${targetDir}"`, { stdio: 'pipe' });
    printSuccess('Step 1: chmod -R 755 (make accessible)');

    // Step 2: chown - change ownership to current user
    execSync(`chown -R ${info.uid}:${info.gid} "${targetDir}"`, { stdio: 'pipe' });
    printSuccess(`Step 2: chown -R to ${info.username}`);

    // Step 3: chmod again - set final permissions
    execSync(`chmod -R 755 "${targetDir}"`, { stdio: 'pipe' });
    printSuccess('Step 3: chmod -R 755 (final permissions)');

    // Make scripts executable
    for (const pattern of ['*.ts', '*.sh', '*.hook.ts']) {
      try {
        execSync(`find "${targetDir}" -name "${pattern}" -exec chmod 755 {} \\;`, { stdio: 'pipe' });
      } catch (e) { /* ignore */ }
    }

All files should NOT be set to 755 permissions. This should only be set on executable files as in the final "Make scripts executable" describes.

One fix for the fixPermissions() bug in PAIInstallWizard.ts on Linux where it "chmod -R 755 ~/.claude" making every file executable looks to be (in this specific order):

#!/usr/bin/bash
#
# Fix PAI permissions for Linux
#

# Set directories to 750
find ~/.claude -type d -exec chmod 750 {} +

# Set all regulare files to 640
find ~/.claude -type f -exec chmod 640 {} +

# Set scripts to 750
find ~/.claude -type f -name "*.ts" -exec chmod 750 {} +
find ~/.claude -type f -name "*.py" -exec chmod 750 {} +
find ~/.claude -type f -name "*.sh" -exec chmod 750 {} +

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions