Changes

Jump to navigation Jump to search
2,015 bytes added ,  08:07, 3 February 2012
Line 27: Line 27:  
* Create a user from the user panel and reset their password
 
* Create a user from the user panel and reset their password
 
* Enable ftp from local networks (I only allow administration of websites from the local network as a matter of security principle!)
 
* Enable ftp from local networks (I only allow administration of websites from the local network as a matter of security principle!)
* Give the user you just created the correct access permissions using the fix_permissions.sh script from [http://drupal.org/node/244924]
+
* Give the user you just created the correct access permissions using the fix_permissions.sh script from http://drupal.org/node/244924 (Note: the contents of this file is at the bottom of this page)
    
For example, say you created a user called '''fred''', then in order for '''fred''' to be able to ftp the required files via the Drupal interface, then you give them permission to do so like this:
 
For example, say you created a user called '''fred''', then in order for '''fred''' to be able to ftp the required files via the Drupal interface, then you give them permission to do so like this:
Line 72: Line 72:     
As a footnote, I would recommend only enabling ftp via the server-manager panel just when you need it so that it is not turned on all the time!
 
As a footnote, I would recommend only enabling ftp via the server-manager panel just when you need it so that it is not turned on all the time!
 +
 +
----
 +
 +
For your convenience, I have reproduced the contents of fix_permissions.sh:
 +
 +
#!/bin/bash
 +
 +
path=${1%/}
 +
user=${2}
 +
group="www"
 +
help="\nHelp: This script is used to fix permissions of a drupal installation\nyou need to provide the following arguments:\n\t 1) Path to your drupal installation\n\t 2)
 +
Username o$
 +
want to give files/directories ownership\nNote: \"www-data\" (apache default) is assumed as the group the server is belonging to, if this is different you need to modify it
 +
manually$
 +
script\n\nUsage: (sudo) bash ${0##*/} drupal_path user_name\n"
 +
 +
if [ -z "${path}" ] || [ ! -d "${path}/sites" ] || [ ! -f "${path}/modules/system/system.module" ]; then
 +
        echo "Please provide a valid drupal path"
 +
        echo -e $help
 +
        exit
 +
fi
 +
 +
if [ -z "${user}" ] || [ "`id -un ${user} 2> /dev/null`" != "${user}" ]; then
 +
        echo "Please provide a valid user"
 +
        echo -e $help
 +
        exit
 +
fi
 +
 +
cd $path;
 +
 +
echo -e "Changing ownership of all contents of \"${path}\" :\n user => \"${user}\" \t group => \"${group}\"\n"
 +
chown -R ${user}:${group} .
 +
echo "Changing permissions of all directories inside \"${path}\" to \"750\"..."
 +
find . -type d -exec chmod u=rwx,g=rx,o= {} \;
 +
echo -e "Changing permissions of all files inside \"${path}\" to \"640\"...\n"
 +
find . -type f -exec chmod u=rw,g=r,o= {} \;
 +
 +
cd $path/sites;
 +
 +
echo "Changing permissions of \"files\" directories in \"${path}/sites\" to \"770\"..."
 +
find . -type d -name files -exec chmod ug=rwx,o= '{}' \;
 +
echo "Changing permissions of all files inside all \"files\" directories in \"${path}/sites\" to \"660\"..."
 +
find . -name files -type d -exec find '{}' -type f \; | while read FILE; do chmod ug=rw,o= "$FILE"; done
 +
echo "Changing permissions of all directories inside all \"files\" directories in \"${path}/sites\" to \"770\"..."
 +
find . -name files -type d -exec find '{}' -type d \; | while read DIR; do chmod ug=rwx,o= "$DIR"; done
 +
 
----
 
----
 
[[Category: Howto]]
 
[[Category: Howto]]
 
[[Category: CMS]]
 
[[Category: CMS]]
 
[[Category: Webapps]]
 
[[Category: Webapps]]
13

edits

Navigation menu