Fix nx attach sudo password prompt - #147
Merged
Merged
Conversation
Changed from using the env command to sudo's native environment variable passing: - Before: sudo -u nexus env SCREENDIR=/tmp/nexus-screen screen -r ... - After: sudo -u nexus SCREENDIR=/tmp/nexus-screen screen -r ... This avoids requiring the env binary to be whitelisted in sudoers while still setting SCREENDIR correctly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
4 tasks
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
Fixes sudo password prompt issue in
nx attachthat appeared after PR #146 was merged.Problem
PR #146 added
env SCREENDIR=/tmp/nexus-screento fix screen session detection, but this caused sudo to prompt for a password:Root Cause
The sudoers configuration typically whitelists specific commands (like
/usr/bin/screen) for passwordless execution. When we added theenvcommand, sudo now sees us trying to run/usr/bin/envinstead of/usr/bin/screen, which isn't whitelisted.Solution
Use sudo's built-in environment variable syntax instead of the
envcommand:This passes the environment variable directly through sudo without needing to whitelist the
envbinary.Changes
"env"from command array (src/nexus/cli/jobs.py:1182)"env"from command array (src/nexus/cli/jobs.py:1198)Test Plan
nx attach <job_id>works on remote target without password promptnx attach <job_id>works on local target🤖 Generated with Claude Code