Should you let an AI agent run terminal commands on your computer?
Coding assistants and some desktop agents can run shell commands: install packages, run tests, move files. That's powerful, and it's also the most direct way an AI mistake can affect your machine.
What can go wrong
- Deleting or overwriting files (a wrong path in a cleanup command)
- Installing packages you didn't intend, sometimes with typo-squatted names
- Changing system settings or environment config
- Running a command suggested by a malicious web page or file it read
Safer ways to allow it
- Approval mode. Most tools can ask before each command. Keep this on until you trust the workflow, and actually read the commands.
- Allow-lists. Permit read-only or routine commands (like running tests) automatically, and require approval for everything else.
- Sandboxes and containers. Run the agent inside a container, virtual machine or cloud workspace so damage stays contained.
- Version control. Work in a git repository and commit before letting the agent loose; you can roll back.
- No admin rights. Avoid giving the agent
sudoor administrator access.
A good default for beginners
Let it propose commands, and you run or approve them. You'll learn what it's doing, and you'll catch the occasional bad idea.
How much command access do you give your coding assistant? Has an approval prompt ever saved you from something?
Comments · 3
Run it in a sandbox or container first. Having it ask for approval on destructive commands like rm is a sensible default.
Is a separate user account with limited permissions a practical safeguard for this?
Yes, a limited account or a container is a solid safeguard. Even a fresh VM keeps experiments away from personal files.