File Permissions & Undo Protections vs AI Agents
- Average speed
- km/h
- Result
- Finish time
- 50 min
- You entered
- Distance
- 10 km
- You entered
File permissions and undo protections can stop AI agents from modifying or deleting files in many cases, but they cannot prevent an AI from reading files it has been granted access to, nor can they fully protect against actions taken through authorized tools or by the user themselves. This article explains what these controls actually do, where they fall short, and how to configure them for safer AI interactions.
Formula
The average pace is the total time divided by the distance:
pace = t / d
where t is the finish time in minutes and d is the distance in kilometers. The average speed is the distance divided by the time in hours:
speed = d / (t / 60)
where t is in minutes, so t / 60 converts to hours. Pace is expressed in minutes per kilometer, speed in kilometers per hour.
Worked Example
Using the default values (finish time = 50 minutes, distance = 10 km):
- Pace = 50 / 10 = 5.00 min/km
- Speed = 10 / (50 / 60) = 10 / 0.8333 = 12.00 km/h
The calculator shows an average pace of 5:00 min/km and an average speed of 12.00 km/h.
What File Permissions Actually Control
File permissions (like Unix chmod or Windows ACLs) define which users or groups can read, write, or execute a file. When an AI agent runs as a specific user, it inherits that user’s permissions. If the agent’s user account has read-only access to a directory, the agent cannot modify or delete files there. However, permissions do not block reading if the user has read access. They also do not stop the agent from creating new files in directories where it has write permission, even if those files are outside the intended scope.
What Undo Protections Can and Cannot Do
Undo protections—such as versioning, snapshots, or trash folders—allow reverting changes after they happen. They do not prevent the change from occurring in the first place. For example, if an AI agent overwrites a document, a versioning system lets you restore the previous version, but the overwrite still happened. Undo protections are a safety net, not a barrier. They also require that the protection system is enabled and that the AI agent does not have permission to delete or purge the backups.
Common Gaps in Protection
- Tool access: If the AI agent can call a tool that bypasses file permissions (e.g., a service account with elevated rights), permissions are ineffective.
- User impersonation: If the AI operates as the user, it can do anything the user can do, including deleting files that permissions would otherwise block for a less privileged account.
- Symlinks and shortcuts: An agent might follow a symbolic link to a file outside the intended directory, bypassing directory-level restrictions.
- Race conditions: In some cases, an agent could modify a file between a permission check and the actual write operation (TOCTOU), though this is rare in practice.
How to Choose the Right Protections
Start by identifying the least privilege needed for the AI agent. If it only needs to read certain files, grant read-only access. If it must write, use a dedicated directory with no access to other areas. Enable versioning or snapshots for any file the agent will modify. For critical files, consider making them immutable (e.g., chattr +i on Linux) so even the agent cannot change them, but note that this also prevents legitimate updates.
Comparing Permission Models
Unix permissions (read/write/execute for owner, group, others) are simple but coarse. Access Control Lists (ACLs) provide finer control, allowing specific users or groups to have different permissions on the same file. Windows NTFS permissions include advanced attributes like “deny” rules and inheritance. For AI agents, the key is to run them under a separate account with minimal permissions, rather than relying on a single set of file permissions.
Safety Best Practices
- Run AI agents in a sandboxed environment (e.g., container or VM) to limit filesystem access.
- Use read-only mounts for directories the agent should not modify.
- Set up regular automated backups to a separate location the agent cannot access.
- Monitor agent actions with logging to detect unauthorized changes early.
- Test your protections by simulating an agent trying to delete or modify files.
Frequently Asked Questions
Can file permissions stop an AI agent from reading a file?
Yes, if the agent’s user account does not have read permission on that file. However, if the agent runs as a user with read access, permissions cannot prevent reading. To block reading, you must remove read permission for that user or use encryption.
Can undo protections prevent data loss from an AI agent?
Undo protections can prevent permanent data loss by allowing restoration, but they do not stop the initial deletion or modification. If the agent also has permission to delete backups or snapshots, those protections are useless.
What is the strongest protection against an AI agent?
The strongest protection is a combination of least-privilege permissions, running the agent in a sandbox with no network access to sensitive systems, and immutable files where possible. No single control is foolproof.
Do file permissions apply to AI agents that use APIs?
File permissions apply to the underlying filesystem. If an AI agent uses an API that accesses files on behalf of a user, the API’s permissions are what matter. The agent itself may not have direct filesystem access, but the API can still perform actions if the user has authorized them.
Can an AI agent bypass file permissions?
An AI agent cannot bypass file permissions unless it exploits a vulnerability (e.g., privilege escalation) or is given higher privileges through misconfiguration. In practice, most bypasses occur because the agent runs with too many permissions.
Should I give an AI agent admin rights?
No. Admin rights give the agent full control over the system, making permissions and undo protections ineffective. Always run AI agents with the minimum privileges necessary for their task.
Related
Formula used
in t | Finish time | min | 50 | 0 in d | Distance | km | 10 | 0 out pace | Average pace | min/km | t / d | 2 out speed | Average speed | km/h | d / (t / 60) | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.