Add sudo privileges guidance to Claude Code agent system prompt - #15
Closed
Wanli-Lee wants to merge 78 commits into
Closed
Add sudo privileges guidance to Claude Code agent system prompt#15Wanli-Lee wants to merge 78 commits into
Wanli-Lee wants to merge 78 commits into
Conversation
The Claude Code harness runs Bash as the unprivileged `user` account. Without guidance, commands needing root (installing packages/games, editing system config, managing services) fail with permission errors and the agent may fabricate results instead of installing what it needs. Instruct it to use `sudo -n` for privileged operations.
Collaborator
|
Reopening under the correct contributor account (94wen94). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Claude Code harness runs its Bash tool as the unprivileged
useraccount. Without explicit guidance, commands that need root (installing packages/games, editing system config, managing services) fail with permission errors, and the agent sometimes fabricates results instead of installing what the task needs.This adds a PRIVILEGES section to the system prompt instructing the agent to use
sudo -n(non-interactive, passwordless) for privileged operations, with concrete examples, and to avoid plainsudo/sudo -Swhich hang on the password prompt.Impact
sudo -n apt-get installrather than being skipped or faked.