A security-focused shell that uses Linux Landlock to provide kernel-enforced filesystem isolation for interactive commands like Claude Code, vim, and other tools.
π Restricts commands to current directory - Interactive commands can only access files in your working directory
β Kernel-enforced - Uses Linux Landlock LSM, cannot be bypassed
π Environment filtering - Controls which environment variables commands can see
βοΈ Configurable - Easy to add custom allowed paths for tools like Claude
# Build
cargo build --release
# Run
cd ~/my-project
/work/oor/shell/target/release/dshell
# Use Claude safely - it can only access ~/my-project
dshell> claude- Filesystem Isolation (Landlock) - Restricts interactive commands to current directory
- Environment Variable Filtering - Controls access to sensitive environment variables
- Configurable Paths - Add custom paths for tools that need config access
- Pre-configured for Claude - Works with Claude Code out of the box
- Good Error Messages - Clear feedback when things go wrong
- Graceful Fallback - Works on older systems without Landlock (with warnings)
# You're working on a sensitive project
cd ~/work/sensitive-project
# Run dshell
dshell
# Run Claude - it's isolated to this project only
dshell> claude
# Claude can access:
# β
~/work/sensitive-project/* (current directory)
# β
~/.claude/ (its config)
# β
System binaries (/usr/bin, etc.)
# Claude CANNOT access:
# β ~/work/other-project/ (different project)
# β ~/Documents/ (outside project)
# β ../parent/ (parent directories)- OS: Linux
- Kernel: 5.13+ (for Landlock) - graceful fallback on older kernels
- Build: Rust 1.70+
- Runtime: Regular user, no root needed
π INSTALL.md - Installation and usage guide π USAGE.md - How to use dshell π CONFIGURING_PATHS.md - How to add custom paths π FILESYSTEM_ISOLATION_PLAN.md - Technical details
cargo build --release
cp target/release/dshell ~/.local/bin/
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrccargo build --release
sudo cp target/release/dshell /usr/local/bin/See INSTALL.md for more options.
Configuration is loaded from ~/.config/dshell/config.toml. A template is provided at config.toml.example.
# Copy the example config
cp config.toml.example ~/.config/dshell/config.toml
# Edit to add your own paths
nano ~/.config/dshell/config.tomlExample configuration:
# Interactive commands that run with filesystem isolation
interactive_commands = ["claude", "vim", "bash", "python", ...]
# Additional paths allowed for isolated commands
additional_allowed_paths = [
"~/.claude", # Claude config
"~/.cargo", # Rust toolchain
"~/.rustup", # Rust toolchain manager
"~/.nvm", # Node.js
# Add your own paths here
]See CONFIGURING_PATHS.md for details.
Without Landlock (Linux <5.13):
β οΈ Environment variables filteredβ οΈ Working directory set- β NO filesystem isolation
With Landlock (Linux 5.13+):
- β Environment variables filtered
- β Working directory set
- β Filesystem isolated by kernel
Interactive commands (configured in src/config.rs):
claude,vim,nvim,nano,emacsbash,sh,python,nodeless,more,man,ssh
Regular commands (NOT isolated):
cat,ls,grep,find,cp,mv- Standard utilities
- Prevents Claude/tools from accessing files outside current directory
- Prevents reading
../sensitive-data/secrets.txt - Prevents writing to
/etc/or other system directories - Blocks access to other projects or home directory files
- Filters sensitive environment variables
- Linux-only (Landlock doesn't exist on macOS/Windows)
- Requires kernel 5.13+ for full isolation
- Can't restrict network access (tools can still make API calls)
- System paths accessible (needed for binaries to run)
See technical details in FILESYSTEM_ISOLATION_PLAN.md.
help # Show help
env # List environment variables
security # Show security status
allow <VAR> # Allow environment variable
deny <VAR> # Deny environment variable
export KEY=VALUE # Set environment variable
echo $VAR # Echo with variable expansion
exit # Exit dshell$ cd ~/my-app
$ dshell
Welcome to dshell terminal!
π Security Features:
β’ Environment Variables: Filtered by default
β’ Filesystem Isolation: ENABLED (Landlock)
Landlock ABI version: V2
β Kernel-enforced - cannot be bypassed
dshell> security
Security Status:
Environment Access: Selective
Allowed: HOME, PATH, USER, SHELL, TERM, LANG, EDITOR, COLORTERM
Plus Rust toolchain vars: RUSTUP_HOME, CARGO_HOME, etc.
dshell> claude
π Filesystem isolated to: /home/user/my-app
# Claude starts and can only access /home/user/my-app
dshell> exit
$If you need to configure Claude Code to use a specific HOME directory, add the following to your Claude Code settings:
File location: .claude/settings.json (in your project) or ~/.claude/settings.json (global)
{
"env": {
"HOME": "/home/dandan"
}
}This ensures Claude Code uses the correct HOME path for all commands. See Claude Code settings documentation for more details.
If you encounter linker errors during build, you may need to configure cargo to use your system's GCC linker explicitly.
Create .cargo/config.toml in your project directory:
[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/gcc"Note: This configuration is target-specific and only affects builds for x86_64-unknown-linux-gnu (64-bit Linux). It will not impact builds for other platforms like Windows, macOS, or ARM architectures. Each platform uses its own default linker.
For CI/CD or temporary builds, you can also use an environment variable:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/gcc cargo buildOr ensure /usr/bin is in your PATH when building:
PATH="/usr/bin:$PATH" cargo buildCheck your kernel:
uname -r # Need 5.13+
cat /sys/kernel/security/lsm | grep landlockCheck the error message - it will tell you if:
- Command not found (not in PATH)
- Permission denied (Landlock blocking it)
- Missing environment variable
Make sure these are in additional_allowed_paths in ~/.config/dshell/config.toml:
~/.claude~/.claude.json~/.nvm~/.npm
No rebuild needed - just restart dshell.
The shell now includes Rust environment variables by default (RUSTUP_HOME, CARGO_HOME, etc.).
Make sure these paths are in additional_allowed_paths in ~/.config/dshell/config.toml:
~/.cargo~/.rustup
These are included in the default config template.
If cargo is still not found, ensure ~/.cargo/bin is in your PATH:
echo $PATH | grep cargoThis was built to safely run Claude Code and similar AI coding assistants in isolated environments.
Ideas for improvements:
- Network isolation (Landlock ABI V4+)
- Dynamic path detection
- Configuration file instead of recompiling
- More granular permissions (read-only vs read-write)
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Built with:
- Landlock - Linux kernel LSM for filesystem isolation
- crossterm - Terminal handling
- Rust - Systems programming language
Generated with assistance from Claude Code π€