4.2.4 Installation

I can't seem to find the following files in order to change their permissions. The changes are required for 4.2.4 installation.



chmod -R 777 design images var



find design -type f -print0 | xargs -0 chmod 666



find image -type f -print0 |xargs -0 chod 666



find var -type f -print0 | xargs -0 chmod 666







Any help would be appreciated…

[quote name='tnchatmonk' timestamp='1417987785' post='198997']

I can't seem to find the following files in order to change their permissions. The changes are required for 4.2.4 installation.



chmod -R 777 design images var



find design -type f -print0 | xargs -0 chmod 666



find image -type f -print0 |xargs -0 chod 666



find var -type f -print0 | xargs -0 chmod 666







Any help would be appreciated…

[/quote]



Design, Images and Var are not files, but directories and are located in CS-Cart root directory. Please, take a look of this screenshot.







Sincere Regards,

Cart-Power

Please find more information about permissions in this article:

[color=#282828][font=arial, verdana, tahoma, sans-serif][size=3]find image -type f -print0 |xargs -0 chmod 666 [/size][/font][/color][color=#282828][font=arial, verdana, tahoma, sans-serif][size=3]doesn't that mean all files in the image directory should be 0666?[/size][/font][/color]





[color=#282828][font=arial, verdana, tahoma, sans-serif][size=3]I am just about to install now and before install I set config.local.php to the following:[/size][/font][/color]



// Default permissions for newly created files and directories

define('DEFAULT_FILE_PERMISSIONS', 0644);

define('DEFAULT_DIR_PERMISSIONS', 0755);



as what I read after install the files will be changed to 0644 and directories to 755 or am I reading this wrong?

Did you check official article which is mentioned in the post #3?


I am bumping this rule since my question is very much related to permissions.



If I set permissions, should I set them as the cpanel account user or as whm root administrator ?



If I do it as the cpanel account user I am mostly inclined to do it within the cpanel environment



[attachment=9811:prnscr_screenshot.png]



Or should I use ftp client like File Zilla helping me set those required permissions ?

prnscr_screenshot.png

All depends on what mode your PHP is running in. Normally it would be the cpanel user.

But note that only root has the permission to change file ownerships.

Suggest you contact your hosting to ask for their help. They will know the specifics of your environment.

Make sure you change the default directory/file permissions in config.local.php to 755/644.

Since I am both the host and the account user is what did before was change the permissions as cpanel account user not as root

and later I started setting permissions as root via ssh. Out the box CSCart by itself from V4.2.2 onward had when you unzipped it in your file manager, again logged in as cpanel account user (not root) and you would see that folders like var, design and images already are set up with permission 777.



So find the instructions a bit confusing, I am referring to setting permission via ssh versus doing it in the cpanel account as user or… via sftp with a ftp program like FileZilla or CoreFTP.



I not sure which is better / preferable to do. Set permissions as root (webhost) or as user (cpanel account user).



The instructions from CSCart is not so evidently clear on that issue.

My point about root related to 'ownership', not permissions.



If the ownership is correct (usually meaning the files/directories are owned by the cpanel user), then the owner of that file/directory (or member of group is parent permissions allow) can change permissions.



In a shell do:


$ cd public_html;
$ find * -type d | xargs chmod 755
$ find * -type f | xargs chmod 644


This assumes that ownership allows you to change permissions of file/directories in public_html.



Note that if you extracted the archive as root, then you MUST change the ownerships FIRST because extracting as root will preserve the user_id and group_id of all files/directoreis as they are listed in the archive. So in this case you would (as root)

```php

cd /home/[cpanel_user]/public_html

chown -R [cpanel_user]:[cpanel_user] .

chgrp nobody .

```

Note the 'chgrp nobody .' is for most systems because Apache runs as group 'nobody' before reading .htaccess and/or invoking PHP.

@tony



I really appreciate the knowledge that you share here with me and other however these last instructions will not do it on my server.



Perhaps I am a bit confused about the instructions



I am familiar with the chown instruction but my cpanel user reads as [cpanel_user]@[domain_set_on_cpanel_user_account.org]

Hoping you replace '[cpanel_user]' above with actual cpanel username or cpanel userid.



If you login to your sever via SSH using your cpanel user as the login name then you will be taken to your home directory.

If you do a

$ ls -ld .

it will show you the username and group name to use. I.e. if your cpanel user_id is' memyme' then you should see something like:

$ ls -ld .
drwx--x--x 25 memyme memyme 4096 Jul 4 15:25 ./


Owner has full permission, group and other have read/execute. Hope that helps. Public_html probably looks like:

$ ls -ld public_html
drwx--x--- 25 memyme nobody 4096 Jul 4 15:25 public_html


In this case the group id is set to 'nobody' and there are no permissions for 'others' Owner has full privilege, group has read/execute and others have none.

Tony



Ok if I follow your instructions by login to my server via SSH using my cpanel user then be taken to that home directory doing:


# ls -ld public_html



I get the following result:


healthavengers@healthavengers.org [~]# ls -ld public_html
drwxr-x--- 9 healthavengers nobody 4096 Jul 6 11:39 public_html/




As you write:


[quote]In this case the group id is set to 'nobody' and there are no permissions for 'others' Owner has full privilege, group has read/execute and others have none[/quote]



If I understand correctly my cpanel user (account) 'healthavengers' is therefor part of the groupid 'nobody' and no permissions for 'others'. But I am not so sure if 'healthavengers' is now also the 'owner' of this 'public_html' directory with full read/execute permissions.





When I use the following commands as cpanel user 'healthavengers' in the 'home/public_html' directory


healthavengers@healthavengers.org [~/public_html]# chmod -R 777 design images var




I get the following results


chmod: changing permissions of `var/cache/registry/pfilters_d93c9fdaccda266e7acd33d78ee39bbe/1': Operation not permitted




That says to me that 'healthavengers' might be belong to the right groupid and might be NOT be the owner of that directory. How can I fix that.

Suggest you do some reading on Linux permissions.

Your user healthavengers is NOT part of group nobody.

Apache runs as group=nobody.

When it goes to spawn PHP in the public_html direcory it first needs to read the .htaccess there and parse it.

It can only do so because it is in group 'nobody'. When it goes to spawn PHP, it then changes its user to healthavengers (which is not a part of group nobody). But because the directory is owned by healthavengers it is all fine.



You'll note the files/directories in your public_html directory are probably all owned by user healthavengers (or should be) and group healthavengers. It is only public_html itself that should be group nobody.



You're going to have to work with your hosting company. You certainly should be able to manage the files/directory permissions within your public_html directory. So I would work with them to get things straightened out.

Oh boy



Ok well I as being my own host, being root administrator to my won dedicated box and also root administrator to the virtual private OpenVZ box which serves as our VPS where our CSCart stores are hosted I contacted Cpanel and they came up with the following:


[quote]Hello,



The problem is within the user's public_html/var/cache directory. Please see the following:

[10:35:59 vps03 healthavengers@6810003 ~/public_html/var/cache]cPs# ls -la total 388

drwxrwxrwx 6 healthavengers healthavengers 4096 Jul 6 23:11 ./

drwxrwxrwx 11 healthavengers healthavengers 4096 Jun 10 09:35 …/

drwxrwxrwx 5 healthavengers healthavengers 4096 Jul 4 21:58 archive/

drwxrwxrwx 5 nobody nobody 4096 Jul 7 17:00 misc/

drwxrwxrwx 4471 nobody nobody 372736 Jul 8 10:32 registry/

drwxrwxrwx 4 nobody nobody 4096 Jul 6 23:12 templates/



The misc, registry, and templates directories are all owned by nobody:nobody, when they should be owned by healthavengers:healthavengers.



I understand that you can make such changes within File Manager, but File Manager uses a different method of changing permissions and ownership than the operating system does.



What you will first need to do is recursively chown the misc, registry, and templates directories to healthavengers:healthavengers as root.



After that is done, the healthavengers user will be able to make further modifications to permissions within those directories.Hello,



The problem is within the user's public_html/var/cache directory. Please see the following:

[10:35:59 vps03 healthavengers@6810003 ~/public_html/var/cache]cPs# ls -la total 388

drwxrwxrwx 6 healthavengers healthavengers 4096 Jul 6 23:11 ./

drwxrwxrwx 11 healthavengers healthavengers 4096 Jun 10 09:35 …/

drwxrwxrwx 5 healthavengers healthavengers 4096 Jul 4 21:58 archive/

drwxrwxrwx 5 nobody nobody 4096 Jul 7 17:00 misc/

drwxrwxrwx 4471 nobody nobody 372736 Jul 8 10:32 registry/

drwxrwxrwx 4 nobody nobody 4096 Jul 6 23:12 templates/



The misc, registry, and templates directories are all owned by nobody:nobody, when they should be owned by healthavengers:healthavengers.



I understand that you can make such changes within File Manager, but File Manager uses a different method of changing permissions and ownership than the operating system does.



What you will first need to do is recursively chown the misc, registry, and templates directories to healthavengers:healthavengers as root.



After that is done, the healthavengers user will be able to make further modifications to permissions within those directories.[/quote]



The message from the CentOS community front was


[quote][color=#333333]We cannot support either cpanel or openvz in this forum. Both replace core portions of CentOS with their own and thus anything we might recommend that would apply to a CentOS system might break yours. You need to talk to cpanel and/or openvz support.[/color][/quote]



So back left to my own expertise or lack there off and with your guiding instructions @tony



I now have the following:


healthavengers@healthavengers.org [~]# ls -ld public_html/*
-rwxr-xr-x 1 healthavengers healthavengers 3833 Jun 6 15:16 public_html/HW-LICENSE.txt*
-rwxr-xr-x 1 healthavengers healthavengers 1335 Nov 27 2014 public_html/admin.php*
-rwxr-xr-x 1 healthavengers healthavengers 1313 Nov 27 2014 public_html/api.php*
drwxr-xr-x 9 healthavengers healthavengers 4096 Nov 27 2014 public_html/app/
drwxr-xr-x 2 healthavengers healthavengers 4096 Jul 6 21:57 public_html/archive/
drwxr-xr-x 2 healthavengers healthavengers 4096 Jun 14 15:29 public_html/cgi-bin/
-rwxr-xr-x 1 healthavengers healthavengers 370626 Nov 27 2014 public_html/changelog.txt*
-rw-rw-rw- 1 healthavengers healthavengers 5216 Jul 7 00:33 public_html/config.local.php
-rwxr-xr-x 1 healthavengers healthavengers 8890 Jul 7 00:32 public_html/config.php*
-rwxr-xr-x 1 healthavengers healthavengers 17318 Nov 27 2014 public_html/copyright.txt*
-rwxr-xr-x 1 healthavengers healthavengers 95818748 Jul 6 21:48 public_html/demostore.tar.gz*
drwxrwxrwx 4 healthavengers healthavengers 4096 May 11 12:32 public_html/design/
-rwxr-xr-x 1 healthavengers healthavengers 4663 May 24 17:30 public_html/error_log*
drwxrwxrwx 9 healthavengers healthavengers 4096 May 21 21:52 public_html/images/
-rwxr-xr-x 1 healthavengers healthavengers 1301 Nov 27 2014 public_html/index.php*
-rwxr-xr-x 1 healthavengers healthavengers 4055 Nov 27 2014 public_html/init.php*
drwxr-xr-x 6 healthavengers healthavengers 4096 May 21 21:53 public_html/js/
-rwxr-xr-x 1 healthavengers healthavengers 1335 Jun 14 20:39 public_html/logmeinadmin.php*
drwxr-xr-x 2 healthavengers healthavengers 4096 May 21 20:56 public_html/mail/
-rwxr-xr-x 1 healthavengers healthavengers 59 Nov 27 2014 public_html/robots.txt*
-rwxr-xr-x 1 healthavengers healthavengers 3072 Nov 27 2014 public_html/store_closed.html*
drwxr-xr-x 6 healthavengers healthavengers 4096 May 21 21:53 public_html/theme_additonal/
drwxrwxrwx 11 healthavengers healthavengers 4096 Jun 10 09:35 public_html/var/
healthavengers@healthavengers.org [~]#




which is now comparable with another cpanel account that is without issues:



one4privacyhosti@one4privacyhosting.com [~]# ls -ld public_html/*
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 3833 Jun 6 15:16 public_html/HW-LICENSE.txt*
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 1313 Nov 27 2014 public_html/api.php*
drwxr-xr-x 9 one4privacyhosti one4privacyhosti 4096 Nov 27 2014 public_html/app/
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 1335 Nov 27 2014 public_html/beheeradmin.php*
drwxr-xr-x 2 one4privacyhosti one4privacyhosti 4096 May 3 11:23 public_html/cgi-bin/
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 370626 Nov 27 2014 public_html/changelog.txt*
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 5203 Jul 7 12:50 public_html/config.local.php*
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 8890 Nov 27 2014 public_html/config.php*
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 17318 Nov 27 2014 public_html/copyright.txt*
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 72590227 May 11 10:44 public_html/cscart_v4.2.4.zip*
-rw-r--r-- 1 one4privacyhosti one4privacyhosti 95818748 Jul 6 11:12 public_html/demostore.tar.gz
drwxr-xr-x 4 one4privacyhosti one4privacyhosti 4096 May 11 12:32 public_html/design/
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 4663 May 24 17:30 public_html/error_log*
drwxr-xr-x 9 one4privacyhosti one4privacyhosti 4096 May 21 21:52 public_html/images/
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 1301 Nov 27 2014 public_html/index.php*
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 4055 Nov 27 2014 public_html/init.php*
drwxr-xr-x 6 one4privacyhosti one4privacyhosti 4096 May 21 21:53 public_html/js/
drwxr-xr-x 2 one4privacyhosti one4privacyhosti 4096 May 21 20:56 public_html/mail/
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 59 Nov 27 2014 public_html/robots.txt*
-rwxr-xr-x 1 one4privacyhosti one4privacyhosti 3072 Nov 27 2014 public_html/store_closed.html*
drwxr-xr-x 6 one4privacyhosti one4privacyhosti 4096 May 21 21:53 public_html/theme_additonal/
drwxrwxrwx 11 one4privacyhosti one4privacyhosti 4096 Jun 10 09:35 public_html/var/




However not still the problem exists that I cannot upload any CSCart addons via the buildin add-on manager



See this screenshot



[attachment=9838:prnscr_nowritablepermissions_addon.png]



According to my cpanel overview in the file manager the directories under /home/healthavengers/ should be writable



See this screenshot



[attachment=9839:prnscr_screenshot_content_public_healthavengers.png]



What am I missing here people ?

prnscr_nowritablepermissions_addon.png

prnscr_screenshot_content_public_healthavengers.png

whew… f your issue is only with the cache directory (and sub-dirs), just go into your file manager and delete public_html/var/cache directory and all will be well. It should be recreated properly.

Guys



I would like to give you all an update on my part on this topic. As it turned out it was problem of conflicts between what I did via SSH and what Cpanel by itself does when you create an account via WHM. It is now all sorted out.



Tony and others like @Aleksey (Ecom-labs) were very helpful with their comments. But as it turned out a few primary settings where not OK on my server and thanks to the people at Cpanel that is now fixed.



It all needed a reset in CentOS - Reset File Permissions on CentOS 6 - GeekPeek.Net



One of the things they at Cpanel did to reset was the following:


[quote][color=#666666][font=arial, helvetica, clean, sans-serif][size=3]Hi there,[/size][/font][/color]



[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]Thank you for contacting us with this issue. We should be able to correct ownership of all of your public_html accounts with this for loop: [/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]============[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]for i in ls -1 /var/cpanel/users/|grep -v "\."; do chown -R $i. /home/$i/public_html/; chown $i.nobody /home/$i/public_html; done[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]============[/size][/font][/color]



[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]We can also correct permissions of files and directories with a couple find commands: [/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]============[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]find /home//public_html -type f -exec chmod 644 {} ;[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]find /home/
/public_html -type d -exec chmod 755 {} ;[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]chmod 750 /home/*/public_html[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]============[/size][/font][/color][/quote]



The last Cpanel technician who work on my server wrote the following:


[quote][color=#666666][font=arial, helvetica, clean, sans-serif][size=3]Hello,[/size][/font][/color]



[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]It appears that the problem with uploading the files is because cgi is being used on the server, which causes the php processes to run as nobody, rather than the user.[/size][/font][/color]



[color=#666666][font=arial, helvetica, clean, sans-serif][size=3][21:02:39 vps03 root@6810003 /home/[my_cpanel_accountname]cPs# /usr/local/cpanel/bin/rebuild_phpconf --current[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]Available handlers: suphp dso cgi none[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]DEFAULT PHP: 5[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]PHP4 SAPI: none[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]PHP5 SAPI: cgi[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]SUEXEC: not installed[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]RUID2: not installed[/size][/font][/color]



[color=#666666][font=arial, helvetica, clean, sans-serif][size=3][21:06:00 vps03 root@6810003 /home/healthavengers/public_html/app]cPs# ps aux | grep php[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]nobody 24672 7.0 0.2 213104 17648 ? R 21:06 0:00 /usr/bin/php[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]nobody 24674 6.5 0.2 212312 17192 ? R 21:06 0:00 /usr/bin/php[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]nobody 24675 11.5 0.3 221484 26804 ? R 21:06 0:00 /usr/bin/php[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]nobody 24676 8.0 0.2 213652 18156 ? R 21:06 0:00 /usr/bin/php[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]nobody 24677 8.5 0.2 214684 19144 ? R 21:06 0:00 /usr/bin/php[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]nobody 24682 0.0 0.0 135484 7468 ? Sl 21:06 0:00 /usr/bin/php[/size][/font][/color]

[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]root 24686 0.0 0.0 103248 864 pts/0 S+ 21:06 0:00 grep php[/size][/font][/color]



[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]Because of that, both 777 permissions would need to be set on the /home/healthavengers/public_html and /home/healthavengers/public_html/app/addons folder. I set the /home/healthavengers/public_html/app/addons folder to 777, which removed the error, however 777 permissions would still need to be set on the public_html folder. That is not secure though and I wouldn't recommend doing that. I would recommend either switching over to suphp as your php handler or adding your FTP credentials to the script when it prompts you rather than trying to use php to upload the files.[/size][/font][/color]



[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]Please let us know how you would like to proceed.[/size][/font][/color]



[color=#666666][font=arial, helvetica, clean, sans-serif][size=3]Thanks![/size][/font][/color][/quote]



He disabled the the CGI module in Apache and from there on no issues no more… except some but they are theme and addon related. See my other post on that.



I hope this information helps someone else in the same predicament.