2 ms·
There is an example of [dis]allowing certain bash commands here: https://code.claude.com/docs/en/settings https://code.claude.com/docs/en/settings As for queri
by stephendause 9mo ago
There is an example of [dis]allowing certain bash commands here: https://code.claude.com/docs/en/settings https://code.claude.com/docs/en/settings
As for queries, you might be able to achieve the same thing with usage of command-line tools if it's a `sqlite` database (I am not sure about other SQL DBs). If you want even more control than the settings.json allows, you can use the claude code SDK.
- nico 9mo agoGreat pointers, thank you How would you go about allowing something like `ssh user@server "ls somefolder/"` but disallowing `ssh user@server "rm"`? Similarly, allow `ssh user@server "mysql \"SELECT...\""`, but block `ssh user@server "mysql \"[UPDATE|DELETE|DROP|TRUNCATE|INSERT]...\""` ? Ideally in a way that it can provide more autonomy for the agent, so that I need to review fewer commands
- stephendause 9mo agoI don't know; I've never done something like that. If no one else answers, you can always ask Claude itself (or another chatbot). This kind of thing seems tricky to get right, so be careful!
- nico 9mo agoYup definitely tricky. Unfortunately Claude sucks at answering questions about itself, I've usually had better luck with ChatGPT. Will see how it goes
- onmai-xyz 9mo agoIf you control the ssh server it can be configured to only allow what you want. Certainly tedious but I would consider it worth while as it stands with agents being well, agentic.
- ktm5j 9mo agoSounds like this might help: https://www.gnu.org/software/bash/manual/html_node/The-Restricted-Shell.html https://www.gnu.org/software/bash/manual/html_node/The-Restr... I'm not familiar with rbash, but it seems like it can do (at least some of) what you want.