How do I set read-only permissions for SSH private key mounted files?
Last updated: September 15, 2025
Context
When using SSH private key files with Spacelift runners, the mounted files need specific read-only permissions to be accepted by SSH. By default, mounted files have 777 permissions, which are too permissive for SSH private keys and will be rejected.
Answer
To set the correct read-only permissions (600) for your SSH private key mounted file, follow these steps:
Navigate to your stack settings
Go to the Hooks tab
Click "Add" under Before Init hooks
Add the following command:
chmod 600 /path/to/your/mounted/keyClick Add to save the hook
Note: You need admin permissions on the stack to add hooks. If you don't see the "Add" option, ensure you have the correct permissions.