Skip to content

Commit 5578c78

Browse files
authored
Merge pull request #1876 from anik120/doc-cred-file-perms
LCORE-1874: Document credential file permission issues in containers
2 parents e979b7e + 15994c9 commit 5578c78

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

docs/container_orchestration.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,67 @@ curl -fsSL https://get.docker.com | sh
597597
sudo firewall-cmd --reload
598598
```
599599

600+
#### 7. Credential File Permission Errors (VertexAI, GCP)
601+
602+
**Symptoms:**
603+
```
604+
PermissionError: [Errno 13] Permission denied: '/tmp/vertex-credentials.json'
605+
google.auth._default.load_credentials_from_file() failed to open credentials file
606+
```
607+
608+
**Cause:**
609+
The llama-stack container runs as UID 1001 (non-root user for security). When you mount a credentials file with restrictive permissions (`600`), the container user cannot read it:
610+
611+
- **Host file:** Owned by your user (e.g., UID 1000) with permissions `600` (owner-only)
612+
- **Container process:** Runs as UID 1001 (different user)
613+
- **Result:** Permission denied - UID 1001 cannot read a file owned by UID 1000 with `600` permissions
614+
615+
**Solutions:**
616+
617+
**Option 1: Use 644 permissions** (Works on all platforms)
618+
```bash
619+
chmod 644 /path/to/vertex-credentials.json
620+
```
621+
622+
Allows container user (UID 1001) to read the file as "others" while keeping write access restricted to owner.
623+
624+
**Security note:** File becomes world-readable on the host. Acceptable for development environments where access to the filesystem is already restricted to your user account.
625+
626+
**Option 2: Use ACLs** (Linux only - more secure)
627+
628+
ACLs (Access Control Lists) allow you to grant read access to UID 1001 specifically without making the file world-readable. **Note:** This only works on Linux systems, not macOS.
629+
630+
**Install ACL tools (Linux):**
631+
```bash
632+
# RHEL/Fedora/CentOS
633+
sudo dnf install acl
634+
635+
# Ubuntu/Debian
636+
sudo apt-get install acl
637+
```
638+
639+
**Grant read access to UID 1001 (Linux only):**
640+
```bash
641+
setfacl -m u:1001:r /path/to/vertex-credentials.json
642+
643+
# Verify
644+
getfacl /path/to/vertex-credentials.json
645+
# Output shows: user:1001:r--
646+
```
647+
648+
This grants read-only access to UID 1001 (container user) without changing base permissions or making the file world-readable.
649+
650+
**macOS note:** macOS uses BSD ACLs and cannot assign numeric UID-based ACLs to non-existent host users. If you are testing locally on macOS, you must temporarily use `chmod 644` to allow the container access, but **be aware that this makes the credentials file world-readable on your host machine.** Alternately, ensure your local user matches the container's execution environment.
651+
652+
**Why this happens:**
653+
This is expected container behavior. The container runs as a non-root user (UID 1001) for security - see `USER 1001` in `deploy/llama-stack/test.containerfile`. Files with `600` permissions are only accessible to their owner, and the container's UID differs from your host UID.
654+
655+
**Production recommendation:**
656+
For production deployments, avoid mounting credential files entirely. Instead use:
657+
- Kubernetes secrets with workload identity
658+
- Cloud provider IAM roles (GCP Workload Identity, AWS IRSA, Azure Managed Identity)
659+
- Secret management systems (Vault, AWS Secrets Manager)
660+
600661
### Debug Logs
601662

602663
The Makefile automatically saves logs to `/tmp` when issues occur:

0 commit comments

Comments
 (0)