SugarCRM - Permissions Script

Sat 21 June 2014

I use salt quite extensively to deploy SugarCRM installs and I wanted a scriptable way to setup the correct permissions for Sugar running on a linux box. This script is based on the Sugar documentation and this handy post here. Simply fill in your apache user details and the path to the Sugar install and you're away.

#!/bin/bash

APACHEUSER='www-data:www-data'
SUGARPATH='/var/www/sugarcrm'

find -P $SUGARPATH/ -type d -exec chmod 755 {} \;
find -P $SUGARPATH/ -type f -exec chmod 644 {} \;
find -P $SUGARPATH/ -name *.js -exec chmod 755 {} \;

chmod 664 $SUGARPATH/config.php
chmod 664 $SUGARPATH/config_override.php
chmod 664 $SUGARPATH/sugarcrm.log

find -P $SUGARPATH/cache -type d -exec chmod 775 {} \;
find -P $SUGARPATH/custom -type d -exec chmod 775 {} \;
find -P $SUGARPATH/data -type d -exec chmod 775 {} \;
find -P $SUGARPATH/modules -type d -exec chmod 775 {} \;
find -P $SUGARPATH/include -type d -exec chmod 775 {} \;
find -P $SUGARPATH/upload -type d -exec chmod 775 {} \;

find -P $SUGARPATH/cache -type f -exec chmod 664 {} \;
find -P $SUGARPATH/custom -type f -exec chmod 664 {} \;
find -P $SUGARPATH/data -type f -exec chmod 664 {} \;
find -P $SUGARPATH/modules -type f -exec chmod 664 {} \;
find -P $SUGARPATH/include -type f -exec chmod 664 {} \;
find -P $SUGARPATH/upload -type f -exec chmod 664 {} \;

chown -R $APACHEUSER $SUGARPATH

And the salt config to get this running.

sugar_permissions:
  cmd.script:
    - source: salt://deploy/dev/sugar/permissions.sh
    - user: root
    - group: root
    - shell: /bin/bash

If you see any issues with the script/salt config please let me know.

Thanks!

Category: SugarCRM Tagged: bash linux permissions

comments


Using PPAs with Salt-States

Thu 10 October 2013

I couldn't seem to find a decent tutorial on using PPA's to manage repos with salt states so I'm documenting it here.

Say you want to install golang using these steps on ubuntu:

sudo add-apt-repository ppa:duh/golang
sudo apt-get update
sudo apt-get install golang

Well, to replicate this into …

Category: SaltStack Tagged: saltstack devops linux

comments

Read More

Screwed Server Checklist

Sat 28 April 2012

My servers started getting unusably slow at peak hours lately and I decided, midst panic to vaguely attempt to document the various things I had to go through to narrow down the problem, anyway I'm sticking them up here so a) I don't lose the list and b) it might …

Category: Devops Tagged: linux panic! server sysadmin

comments

Read More
Page 1 of 2

Next »