chmod Command Reference for CI Scripts
chmod sets the read, write, and execute permission bits on files and directories.
chmod shows up in CI mainly to make scripts executable and to lock down private keys. SSH refuses to use an over-permissive key, so chmod 600 is a common fix.
Common flags/usage
- +x: add the execute bit (chmod +x script.sh)
- 600 / 644 / 755: octal user/group/other permission triples
- -R: apply recursively to a directory tree
- u+x / go-w: symbolic mode (add/remove for user/group/other)
- --reference=FILE: copy another file\u2019s mode
Example
shell
chmod +x scripts/deploy.sh
install -m 600 /dev/stdin "${HOME}/.ssh/id_ed25519" <<< "${SSH_KEY}"
chmod 600 "${HOME}/.ssh/id_ed25519"In CI
SSH and many tools refuse a key with "Permissions 0644 are too open" until you chmod 600 it. A "Permission denied" running a checked-out script usually means the execute bit was lost; chmod +x it. Note that git tracks only the execute bit, so other mode changes do not survive a checkout.
Key takeaways
- chmod 600 a private key or ssh rejects it as too open.
- chmod +x restores the execute bit lost on some checkouts.
- git only tracks the execute bit, so other mode changes are not preserved.
Related guides
ssh Command Reference for CI Scriptsssh opens a secure remote shell or runs a remote command in CI deploys. Reference for -i, -o, BatchMode, and…
ssh-keyscan Command Reference for CI Scriptsssh-keyscan fetches a host\u2019s public keys to pre-seed known_hosts in CI. Reference for -H, -t, -p, and th…
ln -s Command Reference for CI Scriptsln -s creates symbolic links in CI for toolchains and shared paths. Reference for -s, -f, -n, and -r, plus th…
cp Command Reference for CI Scriptscp copies files and directories in CI for staging artifacts. Reference for -r, -p, -a, and trailing-slash beh…