mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-02 04:37:49 +02:00
Add danger mode for sudoless agent work on system administration
This commit is contained in:
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Toggle passwordless sudo for the current user.
|
||||
# First run: enables passwordless sudo (after confirmation).
|
||||
# Second run: disables it.
|
||||
|
||||
NOPASSWD_FILE="/etc/sudoers.d/99-omarchy-nopasswd-${USER}"
|
||||
|
||||
if [ -f "$NOPASSWD_FILE" ]; then
|
||||
sudo rm "$NOPASSWD_FILE"
|
||||
echo "Passwordless sudo has been DISABLED. Sudo will require a password again."
|
||||
else
|
||||
echo ""
|
||||
echo "⚠️ WARNING: This will allow ANY process running as your user to"
|
||||
echo "execute ANY command as root WITHOUT a password."
|
||||
echo ""
|
||||
echo "This is useful for AI agents that need to run sudo commands,"
|
||||
echo "but it significantly weakens the security of your system."
|
||||
echo "Anyone or anything with access to your user account gets full root."
|
||||
echo ""
|
||||
echo "Only enable this while actively using an AI agent, then run"
|
||||
echo "this command again to disable it."
|
||||
echo ""
|
||||
|
||||
if gum confirm "Enable passwordless sudo? This is a significant security risk!"; then
|
||||
echo "${USER} ALL=(ALL) NOPASSWD: ALL" | sudo tee "$NOPASSWD_FILE" > /dev/null
|
||||
sudo chmod 440 "$NOPASSWD_FILE"
|
||||
echo "Passwordless sudo has been ENABLED. Run this command again to disable it."
|
||||
else
|
||||
echo "Aborted. No changes made."
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user