Skip to content

Instantly share code, notes, and snippets.

@khatriafaz
Last active September 1, 2021 11:20
Show Gist options
  • Save khatriafaz/cc43a95a22449bce86c9f8b17b862612 to your computer and use it in GitHub Desktop.
Save khatriafaz/cc43a95a22449bce86c9f8b17b862612 to your computer and use it in GitHub Desktop.
Shell script to apply proper directory and file permissions after cloning the project on cPanel servers
#!/bin/bash
username="${1:-$USER}"
folder="${2:-.}"
chown -R $username:$username $folder
find $folder -type f -exec chmod 644 {} \;
find $folder -type d -exec chmod 755 {} \;
chmod 755 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment