Fix log permissions
Skill choutos/agent-skills-spec/examples/fix-log-permissions
Fix Laravel log file permission errors after deployment. Use when seeing "UnexpectedValueException: Permission denied" for storage/logs/laravel.log, or after any deployment that may change file ownership. Triggers on: laravel, log permissions, www-data, storage/logs, permission denied.From its SKILL.md
npx -y skills add choutos/agent-skills-spec --skill fix-log-permissionsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- runs commandsInstructs the agent to run 3 commands, including `sudo chown -R www-data:www-data /var/www/storage/logs/` and 2 more.
SKILL.md
1.0 KB, 177 tokens by cl100k_base, as published. Nobody here has run it
Fix Laravel Log Permissions
Symptoms
UnexpectedValueException: .../storage/logs/laravel.log Permission denied- Application returns 500 errors after deployment
- Log file owned by
rootinstead ofwww-data
Fix
# Fix ownership
sudo chown -R www-data:www-data /var/www/storage/logs/
# Restart PHP-FPM (adjust version as needed)
sudo systemctl restart php8.2-fpm
Or use the script: scripts/fix-perms.sh <ssh-host>
Root Cause
Deployment runs as root, creating or modifying log files with root ownership. The web server (www-data) then can't write to them.
Prevention
Add to post-deploy hook:
chown -R www-data:www-data /var/www/storage/logs/
What ships with it: 1 file
360 B alongside SKILL.md, 1 of them executable
scripts/
- fix-perms.shruns360 B