π OpenHands: AI-Driven Development
support running sudo in a passwordless manner (#906)
Xingyao Wang3c82ba7f3482
diff --git a/opendevin/sandbox/sandbox.py b/opendevin/sandbox/sandbox.pyindex abc40bd661..d7c7aafb3c 100644--- a/opendevin/sandbox/sandbox.py+++ b/opendevin/sandbox/sandbox.py@@ -140,6 +140,18 @@ class DockerInteractive(CommandExecutor):atexit.register(self.cleanup)def setup_user(self):++ # Make users sudoers passwordless+ # TODO(sandbox): add this line in the Dockerfile for next minor version of docker image+ exit_code, logs = self.container.exec_run(+ ['/bin/bash', '-c',+ r"echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers"],+ workdir='/workspace',+ )+ if exit_code != 0:+ raise Exception(+ f'Failed to make all users passwordless sudoers in sandbox: {logs}')+# Check if the opendevin user existsexit_code, logs = self.container.exec_run(['/bin/bash', '-c', 'id -u opendevin'],