uddhava Posted February 18, 2010 Share Posted February 18, 2010 Version : 1.0Compatibility : Only for Linux/unix hostsAuthor : Uddhava dasInfoI have been installing PS for too many times i can remember. So always i get stuck with manually changing all the needed file permissions during install.Since the PS installer is not complete, many more files need some change of permissions.So to make my life simpler i have written a shell script (linux/bash/ksh/sh) that does it for me.So all you Apache/Linux ISP victims can use it so change the permissions easily.SecurityWARNING : Some files and dirs will be chmod to 777. If you have a ISP that uses shared hosting, (like mine) than apache runs as its own process for all users. Then your files and dirs will need to use 777 for Prestashop. When your ISP uses a local apache for each user (nice ISP) then chmod 777 is not needed."So choose wisely..."Usage* Unzip script and upload in the ROOT of your prestashop.* make this script executable (chmod u+x)* Run scriptWhen you have changed your admin dir, then change this also in the script. History17 feb 2010 : Launched script to the world Download perms.zip 2 Link to comment Share on other sites More sharing options...
uddhava Posted February 18, 2010 Author Share Posted February 18, 2010 Ok dudes, here is the script in text form : # Little script to setup the correct file/dir permissions # You can use this during and after the install of prestashop # 17 feb 2010 : Version 1.0 # Author : Uddhava das # Are you sure? read -p "Are you sure? " -n 1 if [[ ! $REPLY =~ ^[Yy]$ ]] then exit 1 fi echo "" # root files echo "Change permissions on files AND Dirs of" echo "config" chmod 777 config echo "sitemap.xml" chmod 666 sitemap.xml echo "tools/smarty/compile" chmod 777 tools/smarty/compile echo "" echo "Change permissions on dirs only" echo "Modules dir" chmod 777 modules echo "All subfolders in modules" find modules/* -type d -print0 |xargs -0 chmod 777 echo "" echo "import dir in /admin/import -> If you renamed your admin dir, then change this" chmod 777 admin/import echo "backup dir (/admin/import) -> If you renamed your admin dir, then change this" chmod 777 admin/backup chmod 777 upload echo "All subfolders in upload" find upload/* -type d -exec chmod 777 {} \; echo "" chmod 777 download echo "All subfolders in download" find download/* -type d -exec chmod 777 {} \; echo "" # Translations folder echo "translations folder" chmod 777 translations echo "All subfolders in translations" find translations/* -type d -print0 |xargs -0 chmod 777 echo "" # Translations files. echo "Change permissions of files in translations folders" find translations/* -type f -exec chmod 666 {} \; echo "except index.php" find translations/* -name index.php -exec chmod 644 {} \; echo "mails folder" chmod 777 mails echo "mails subfolders" echo "All subfolders in mails" find mails/* -type d -print0 |xargs -0 chmod 777 echo "img folder" chmod 777 img echo "All subfolders in img" find img/* -type d -print0 |xargs -0 chmod 777 # Some loose files that need to have write permissions echo "Some other files that need to be writable" echo "logo in /img" chmod 666 img/logo.jpg echo "favicon.ico in /img" chmod 666 img/favicon.ico echo "editorial.xml file for home page" chmod 666 modules/editorial/editorial.xml echo "" # Themes language files. ADD YOUR OWN THEME HERE echo "themes folder and language files in folder" echo "Add your theme here" echo "lang folder to 777" chmod 777 themes/prestashop/lang chmod 777 themes/varsana/lang echo "all files in lang folder to 666 " chmod 666 themes/prestashop/lang/* chmod 666 themes/varsana/lang/* echo "" # All language files in the modules folder. Add your language echo "find all language files in modules folder and subfolders" echo "Add new language if needed" echo "Supported are en, es, fr and nl" find modules/* -name en.php -exec chmod 666 {} \; find modules/* -name es.php -exec chmod 666 {} \; find modules/* -name fr.php -exec chmod 666 {} \; find modules/* -name nl.php -exec chmod 666 {} \; echo "" echo "Done..." Link to comment Share on other sites More sharing options...
uddhava Posted March 4, 2010 Author Share Posted March 4, 2010 Since 1.3.0.2 the permissions displayed in the installer are always correct.That could mean that 1) Prestashop can now work without setting the permissions2) My provider changed somethingSo did PS change something regarding the file permissions ? Link to comment Share on other sites More sharing options...
smenster Posted March 29, 2010 Share Posted March 29, 2010 How do i execute this script? Can it be executed from filezilla or any other ftp client? Or do i execute it from my hosts control panel?Thanks! Link to comment Share on other sites More sharing options...
uddhava Posted March 29, 2010 Author Share Posted March 29, 2010 This is a shell script that needs to be executed in a SSH session on your host. It cannot be executed from Filezilla/ftp or control panels.From your question can i deduce that you have never used unix/linux prompts before?If so then do not use this script.. Link to comment Share on other sites More sharing options...
smenster Posted March 29, 2010 Share Posted March 29, 2010 you're exactly right, never used the unix/linux prompt. I'll do it the dummy way :-). Thanks for your prompt reply! Link to comment Share on other sites More sharing options...
makaraci Posted July 1, 2010 Share Posted July 1, 2010 thanks pal Link to comment Share on other sites More sharing options...
timir Posted October 2, 2010 Share Posted October 2, 2010 Thanks Udhav this is a helpful script. What did you mean by "When you have changed your admin dir, then change this also in the script."Cheers !! Link to comment Share on other sites More sharing options...
rocky Posted October 3, 2010 Share Posted October 3, 2010 It means you need to change 'admin' in these lines to whatever you renamed your admin directory to: echo "import dir in /admin/import -> If you renamed your admin dir, then change this" chmod 777 admin/import echo "backup dir (/admin/import) -> If you renamed your admin dir, then change this" chmod 777 admin/backup Link to comment Share on other sites More sharing options...
jhnstcks Posted October 3, 2010 Share Posted October 3, 2010 My host has softaculous installed in their cpanel (like fantastico) which has Prestashop installer option. This can also run as an upgrade and it changes the folder permissions by itself. Link to comment Share on other sites More sharing options...
Joachim Tranberg Posted October 7, 2010 Share Posted October 7, 2010 Can someone tell me, how this exactly.Do i have to use it via. FTP on my server, and then run the script? Link to comment Share on other sites More sharing options...
hornetbzz Posted November 8, 2010 Share Posted November 8, 2010 Yes thx uddhavaEven if I do not like so much chmoding 777 ;-)I rewrote your script in a slighlty different mode as I experienced bad situation chmoding files and directories.Also the lang directories and file search is now automatized.Here is it attached if it can help others.Tested on Debian Lenny with prestashop 1.3.2.3 my_prestashop_install.zip Link to comment Share on other sites More sharing options...
Martin Hedegaard Posted June 25, 2011 Share Posted June 25, 2011 those this script work with prestashop version 1.4.3? Link to comment Share on other sites More sharing options...
wippa Posted August 19, 2013 Share Posted August 19, 2013 (edited) This is a shell script that needs to be executed in a SSH session on your host. It cannot be executed from Filezilla/ftp or control panels. Control panels: Maybe if you have access to cron but not shh console... (never tried into a shared hosting) A cute option will be use a php file with shell_exec() function with correct user (cron user). (http://php.net/manua....shell-exec.php() ) Other option will be use chmod() php function (http://php.net/manua...ction.chmod.php) but not sure about user. However, im writting because im looking not for an "setup and patch" permissions script. Im searching for a table with all permisions needer for all files/folders in prestashop 1.4 & 1.5 to correct some "wrong instalations or corrupted by som sysadmin ". I will make my own sh, or php (and post here of course) file for correct it, but dont know where is a relationship about permissions. I only need special ones, like 666, or 777. For all other one I use a "find & set" script to set 664 to files and 755 to folders. Anyone know? Regards. Edited August 19, 2013 by wippa (see edit history) Link to comment Share on other sites More sharing options...
gpzim98 Posted May 18, 2015 Share Posted May 18, 2015 Than you! It's works very well.. One problem that others peoples will get is owner of folder, to solve make a chown www-data:www-data -R your_folder_master_of_prestashop . Remember that ww-data is a user example of Apache, but in each case look for the right user to do. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now