From rhcp, 3 Years ago, written in Bash.
Embed
  1. #!/bin/bash
  2. #
  3. # Simple bash to fix up wordpress on apache
  4. #
  5. # By: john.b.hale@gmail.com
  6.  
  7. # Get the current User Name
  8. USER=`env|grep USER|cut -d= -f2`
  9.  
  10.  
  11. echo "[+] Setting www-data and file/dir perms[+]"
  12. echo "[=] Sudo Enabled [=]"
  13. sudo chown www-data:www-data  -R * $1              
  14. sudo find $1 -type d -exec chmod 755 {} \;
  15. sudo find $1 -type f -exec chmod 644 {} \;  
  16.  
  17. echo "[+] Setting the username to have access and setting wp-content to www-data [+]"
  18. sudo chown $USER:$USER  -R $1 # Let your useraccount be owner
  19. sudo chown www-data:www-data $1/wp-content # Let apache be owner of wp-content
  20. echo "[=] Done [=]"
  21.