A script fails with `/bin/bash^M: bad interpreter: No such file or directory`.
BeginnerTroubleshootingPermissions, ownership, SELinux and mounts
Answer
Likely causes → Windows CRLF line endings; the kernel looks for an interpreter literally named bash\r.
Diagnose →
file deploy.sh # "with CRLF line terminators"
head -1 deploy.sh | cat -A
Fix → sed -i 's/\r$//' deploy.sh or dos2unix deploy.sh.
Prevent → Add *.sh text eol=lf to .gitattributes and a pre-commit check.
More on Permissions, ownership, SELinux and mounts
nginx returns 403 and logs `open() "/srv/www/index.html" failed (13: Permission denied)`, even after `chmod -R 777 /srv/www`.IntermediateA script fails with `bash: ./deploy.sh: Permission denied` even though `ls -l` shows `-rwxr-xr-x`.BeginnerA user gets `-bash: cd: /srv/project: Permission denied` although they're in the group that owns `/srv/project` (mode `770`).BeginnerApache can't connect to a backend: `AH00957: HTTP: attempt to connect to 127.0.0.1:8080 (localhost) failed` and `ausearch` shows `denied { name_connect }`.IntermediateA service fails to bind to a custom port: `bind() to 0.0.0.0:8888 failed (13: Permission denied)` while running as root.IntermediateFiles moved with `mv` from a home directory into `/var/www/html` give 403 errors, but files created there directly work.Intermediate