[BUG] Dangerous system-breaking sudo chown suggestion in `claude doctor` for Ubuntu users
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.98 (Claude Code)
- Operating System: Ubuntu 22.04 (WSL2)
- Terminal: bash
## Bug Description
The claude doctor command suggests a potentially destructive fix that can break
Ubuntu systems when npm global prefix is set to /usr. The suggested command sudo becomes
chown -R $USER:$(id -gn) $(npm -g config get prefix)sudo chown -R $USER:$(id which changes ownership of critical system directories.
-gn) /usr
## Steps to Reproduce
- Install npm on Ubuntu with default configuration (prefix set to
/usr) - Run
claude doctorcommand - Observe the warning: "Insufficient permissions for auto-updates"
- Note the suggested fix:
sudo chown -R $USER:$(id -gn) $(npm -g config get prefix)
## Expected Behavior
The doctor command should provide safe solutions such as:
- Always recommend
claude migrate-installeras the primary fix - Check if npm prefix points to system directories before suggesting chown
- Warn users about potential system damage
- Never suggest changing ownership of
/usror other system directories
## Actual Behavior
The doctor suggests a command that expands to sudo chown -R $USER:$(id -gn) /usr on
Ubuntu systems, which would break the entire operating system by changing ownership of
critical system files and directories.
## Additional Context
- On Ubuntu,
npm -g config get prefixdefaults to/usr - Running the suggested command would require system reinstallation
- The safe alternative
claude migrate-installerworks perfectly and resolves the
warning
- This affects any Ubuntu user following the doctor's recommendations
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗