Jump to content



Photo
- - - - -

Checking File Permissions


  • Please log in to reply
71 replies to this topic

#1   geoffreywalton

geoffreywalton

    Professional Developer

  • Community Sponsor
  • 8,247 posts
  • Real Name:Geoffrey Walton
  • Gender:Male
  • Location:Norfolk, UK (close to the centre of the universe)

Posted 06 August 2008 - 22:05

Do you want to check the file and directory permissions on your server match those specified in the post installation instructions in the knowledgebase?

You can run this feature in 2 modes. Check and Update. One shows what would be done if the permissions, which you can set on the screen, are applied and the other shows the changes actually made.

It is possible that your server will throw 500 "Internal Server Error" if you set the permissions to values they do not like. As you get a display of all the changes made, make sure you test your site before you leave the results page. (You can set everything back.)

Sometimes you can get this when you upload files for a contribution.

Being paranoid, I recommend you back up you site content to your pc using an ftp client before playing around with permissions.

Also it would be good if you know how to change permissions from your ISP's control panel and using an ftp client such as filezilla.

Now available from http://addons.oscommerce.com/info/6134

Edited by geoffreywalton, 06 August 2008 - 22:06.

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.

For links mentioned in old answers that are no longer here follow this link Useful Threads.

If this post was useful, click the Like This button over there ======>>>>>.

#2   azer

azer
  • Members
  • 842 posts
  • Real Name:azer
  • Location:Paris, france

Posted 11 August 2008 - 17:01

it seems to be a terrific tool , it can save hours !!!
let me thank you :-)

im gonna test it now

for the chmod , how to know for sure the official chmod required and advised ?

by the way don't forget to look at this contribtuion who has the same goal http://www.oscommerc...tributions,2137
it s more graphic but go less deeper !
MS2

#3   markg-uk

markg-uk
  • Members
  • 309 posts
  • Real Name:Mark
  • Gender:Male
  • Location:Kent, UK

Posted 12 August 2008 - 08:44

Looks a good contribution.

Might be useful to have a filter in there somewhere to not show files that have the correct permissions (for people who have lots of files)

#4   callaway

callaway
  • Members
  • 51 posts
  • Real Name:cab
  • Gender:Male
  • Location:Derby

Posted 18 December 2008 - 16:14

Hi,

I have a couple of problems with the contribution and wondered if anyone could help?

Firstly before the file checking starts I get this line:

Set Standard File And Directory Permissions

**Permission check in progress (no changes will be made).**

The directory backups exists, so this is OK.

The admin directory is called shop

Type Name Original permissions Actions / Results
Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /homepages/nn/dnnnnnnnnn/htdocs/shop/admin/check_permissions.php on line 360
File ./account.php 755 Action Required, should be
File ./stylesheet.css 755 Action Required, should be
Directory ./images 755 Action Required, should be
File ./account_edit.php 755 Action Required, should be


Then runs OK for a while until this:

File ./images/default/Thumbs.db 755 Action Required, should be
File ./images/banners/oscommerce.gif 755 Action Required, should be
File ./images/banners/Thumbs.db 755 Action Required, should be


1146 - Table 'dbnnnnnnnnn.TABLE_COUNTER' doesn't exist

select startdate, counter from TABLE_COUNTER



Now table COUNTER doesn't exist, table counter (lower case does)
So I added the table but still received the error?

Any help much appreciated.

#5   geoffreywalton

geoffreywalton

    Professional Developer

  • Community Sponsor
  • 8,247 posts
  • Real Name:Geoffrey Walton
  • Gender:Male
  • Location:Norfolk, UK (close to the centre of the universe)

Posted 18 December 2008 - 19:53

What version of osc are you using?

G
Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.

For links mentioned in old answers that are no longer here follow this link Useful Threads.

If this post was useful, click the Like This button over there ======>>>>>.

#6   geoffreywalton

geoffreywalton

    Professional Developer

  • Community Sponsor
  • 8,247 posts
  • Real Name:Geoffrey Walton
  • Gender:Male
  • Location:Norfolk, UK (close to the centre of the universe)

Posted 18 December 2008 - 20:56

That line is looking for an entry for TABLE_COUNTER in /includes/database_tables.php.

The only place it is called is from the standard footer in the shop, in the rc2a version, not the admin area, so am a little confused as to why it is being called from a php file the admin area.

Have you copied the shop footer.php to /admin?
Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.

For links mentioned in old answers that are no longer here follow this link Useful Threads.

If this post was useful, click the Like This button over there ======>>>>>.

#7   projectpb

projectpb
  • Members
  • 7 posts
  • Real Name:Jeff
  • Gender:Male

Posted 28 December 2008 - 04:21

i am getting the same thing with my install of MNK Edition based off osCommerce 2.2 rc2a this mod is pre installed with the MNK version
thanks
Jeff




[quote name='callaway' date='Dec 18 2008, 11:14 AM' post='1348674']
Hi,

I have a couple of problems with the contribution and wondered if anyone could help?

Firstly before the file checking starts I get this line:

Set Standard File And Directory Permissions

**Permission check in progress (no changes will be made).**

The directory backups exists, so this is OK.

The admin directory is called shop

Type Name Original permissions Actions / Results
Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /homepages/nn/dnnnnnnnnn/htdocs/shop/admin/check_permissions.php on line 360
File ./account.php 755 Action Required, should be
File ./stylesheet.css 755 Action Required, should be
Directory ./images 755 Action Required, should be
File ./account_edit.php 755 Action Required, should be


Then runs OK for a while until this:

File ./images/default/Thumbs.db 755 Action Required, should be
File ./images/banners/oscommerce.gif 755 Action Required, should be
File ./images/banners/Thumbs.db 755 Action Required, should be


1146 - Table 'dbnnnnnnnnn.TABLE_COUNTER' doesn't exist

select startdate, counter from TABLE_COUNTER



Now table COUNTER doesn't exist, table counter (lower case does)
So I added the table but still received the error?

Any help much appreciated.
[/quote

#8   projectpb

projectpb
  • Members
  • 7 posts
  • Real Name:Jeff
  • Gender:Male

Posted 28 December 2008 - 21:19

i copyed the footer.php to admin and it helped the top message is now gone Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /homepages/nn/dnnnnnnnnn/htdocs/shop/admin/check_permissions.php on line 360 the only thing that was different was the url address i copyed he message to make the post quick



this one is still their
1146 - Table 'projedd1_mnkosc.TABLE_COUNTER' doesn't exist

select startdate, counter from TABLE_COUNTER

[TEP STOP]

this is at bottom of the page after u click on the check permissions

Edited by projectpb, 28 December 2008 - 21:20.


#9   geoffreywalton

geoffreywalton

    Professional Developer

  • Community Sponsor
  • 8,247 posts
  • Real Name:Geoffrey Walton
  • Gender:Male
  • Location:Norfolk, UK (close to the centre of the universe)

Posted 28 December 2008 - 21:39

The admin/includes/footer.php should be as follows

<?php
/*
  $Id: footer.php,v 1.12 2003/02/17 16:54:12 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/
?>
<br>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td align="center" class="smallText">
<?php
/*
  The following copyright announcement is in compliance
  to section 2c of the GNU General Public License, and
  thus can not be removed, or can only be modified
  appropriately.

  For more information please read the osCommerce
  Copyright Policy at:

  http://www.oscommerce.com/about/copyright

  Please leave this comment intact together with the
  following copyright announcement.
*/
?>
E-Commerce Engine Copyright &copy; 2005 <a href="http://www.oscommerce.com" target="_blank">osCommerce</a><br>
osCommerce provides no warranty and is redistributable under the <a href="http://www.fsf.org/licenses/gpl.txt" target="_blank">GNU General Public License</a>
	</td>
  </tr>
  <tr>
	<td><?php echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', '1', '5'); ?></td>
  </tr>
  <tr>
	<td align="center" class="smallText">Powered by <a href="http://www.oscommerce.com" target="_blank">osCommerce</a></td>
  </tr>
</table>

If you copy the footer from the shop you will get the error because the counter table is not defined in database_tables.php. Either put the correct footer back or define it in the tables file.

Might be a good idea to contact your template provider and point out their error.
Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.

For links mentioned in old answers that are no longer here follow this link Useful Threads.

If this post was useful, click the Like This button over there ======>>>>>.

#10   callaway

callaway
  • Members
  • 51 posts
  • Real Name:cab
  • Gender:Male
  • Location:Derby

Posted 04 January 2009 - 15:53

Apologies for the late reply due to Xmas and New Year. By the way Happy New Year!

I checked and footer.php in the admin area is exactly the same as it is in your example.

I too am using a template (never again!) so perhaps there is something in there that is causing the problem?

I am still getting:
1146 - Table 'db266941211.TABLE_COUNTER' doesn't exist

select startdate, counter from TABLE_COUNTER

[TEP STOP]

Anythink else that needs to be checked?

#11   geoffreywalton

geoffreywalton

    Professional Developer

  • Community Sponsor
  • 8,247 posts
  • Real Name:Geoffrey Walton
  • Gender:Male
  • Location:Norfolk, UK (close to the centre of the universe)

Posted 04 January 2009 - 16:32

No, somewhere you have a reference to a table that is not listed as a files that the admin area can access (see file in admin/includes).

The offending code is probably

require(DIR_WS_INCLUDES . 'counter.php');

which refers to the script /includes/counter.php

G
Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.

For links mentioned in old answers that are no longer here follow this link Useful Threads.

If this post was useful, click the Like This button over there ======>>>>>.

#12   Dhalgren

Dhalgren
  • Members
  • 5 posts
  • Real Name:Mark

Posted 05 February 2009 - 21:13

Same exact problem as the others. I copied your footer.php to Admin and nothing changed. Sure wish i could use this add-on.

#13   geoffreywalton

geoffreywalton

    Professional Developer

  • Community Sponsor
  • 8,247 posts
  • Real Name:Geoffrey Walton
  • Gender:Male
  • Location:Norfolk, UK (close to the centre of the universe)

Posted 05 February 2009 - 23:52

Should be to /admin/includes/footer.php

Try changing line 541 of check_permissions.php from....

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>


to

<?php //require(DIR_WS_INCLUDES . 'footer.php'); ?>
Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.

For links mentioned in old answers that are no longer here follow this link Useful Threads.

If this post was useful, click the Like This button over there ======>>>>>.

#14   lightshine

lightshine
  • Members
  • 36 posts
  • Real Name:Lightshine
  • Location:Singapore

Posted 06 February 2009 - 03:10

Hi Geoffrey Walton,

Do you have an additional configuration file which allow files or folders to be added from the Admin panel onto the Check File Permissions mod, instead of modify from the php file?

Thanks!

Edited by lightshine, 06 February 2009 - 03:11.


#15   Dhalgren

Dhalgren
  • Members
  • 5 posts
  • Real Name:Mark

Posted 06 February 2009 - 22:01

Hey!! That seems to have worked. No errors so far. Thank you!

#16   geoffreywalton

geoffreywalton

    Professional Developer

  • Community Sponsor
  • 8,247 posts
  • Real Name:Geoffrey Walton
  • Gender:Male
  • Location:Norfolk, UK (close to the centre of the universe)

Posted 07 February 2009 - 09:32

Hi Geoffrey Walton,

Do you have an additional configuration file which allow files or folders to be added from the Admin panel onto the Check File Permissions mod, instead of modify from the php file?

Thanks!


no, which files and folders are missing?

G
Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.

For links mentioned in old answers that are no longer here follow this link Useful Threads.

If this post was useful, click the Like This button over there ======>>>>>.

#17   hlee

hlee
  • Members
  • 16 posts
  • Real Name:Hendra

Posted 10 February 2009 - 04:29

I would lilke to say thank you to Geoffrey Walton for the contribution which is very useful.

Very clear instruction, easy to follow.

Now can control file and folder permission easily and safe a lot of time.

Once again thanks Geoffrey for the good work.

GOD Bless you.

#18   lightshine

lightshine
  • Members
  • 36 posts
  • Real Name:Lightshine
  • Location:Singapore

Posted 10 February 2009 - 08:27

no, which files and folders are missing?

G

Nothing is missing but if we need to add in our own files and folders, the admin panel setting side for the check permission would be useful. We wouldn't want to mess around with the php file for the contribution, hope you understood what i meant.
Just my 2 cents worth of thoughts and thanks for the great contribution!

#19   magdalena

magdalena
  • Members
  • 163 posts
  • Real Name:Lillian
  • Gender:Female
  • Location:DFW, Tx

Posted 28 February 2009 - 05:34

Hi. This is a great, and easy to run/install, contribution.

I put it in a rc2a system and had one minor problem:

Warning: chmod() [function.chmod]: Operation not permitted in /home/jwewbro1/public_html/admin/check_permissions.php on line 326

if (!$testrun) {

							if(substr($current_file,-3,3) == 'bak'){
								unlink($path);
							} else {
								switch ($correct_mod) {
									case 777:					
										$ch = chmod($current_file, 0777);
										break;
									case 755:
										$ch = chmod($current_file, 0755);
										break;
									case 744:					
										$ch = chmod($current_file, 0744);
										break;
									case 644:					
THIS IS LINE 326									$ch = chmod($current_file, 0644);
										break;
									case 444:
										$ch = chmod($current_file, 0444);
										break;
									case 440:
										$ch = chmod($current_file, 0440);
										break;
									case 400:
										$ch = chmod($current_file, 0400);
										break;							
									default:
										$ch = chmod($current_file, 0644);
								}
//								if ($ch ){echo '<br>ok '.$current_file; }else{echo '<br>ohoh '.$current_file;}
							}
						}

						echo "<tr>
							<td>File</td>
							<td>" . $current_file . "</td>
							<td>" . decoct($mode) . "</td>
							<td>" . ((decoct($mode)==$correct_mod) ? "OK" : (($testrun) ? "Action Required, should be  " . $correct_mod : ($ch ? "Updated to " . $correct_mod : "Update failed"))) . "</td>
						</tr>";

					  } // if if_dir
if ($i > 5000) {
	break;
}

It looks like everything worked. I ran a check with the same 644/755 values and it checked out. Also, on CPANEL.
Is there a way to eliminate the error message?

Let me know.
Once again, great mod!

#20   geoffreywalton

geoffreywalton

    Professional Developer

  • Community Sponsor
  • 8,247 posts
  • Real Name:Geoffrey Walton
  • Gender:Male
  • Location:Norfolk, UK (close to the centre of the universe)

Posted 28 February 2009 - 16:06

For some reason your configuration on the server is not letting you change the permissions on a file to 644.

Have a look at the directory permissions the file is in and the file permissions.

Glad you found it of use.

G
Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.

For links mentioned in old answers that are no longer here follow this link Useful Threads.

If this post was useful, click the Like This button over there ======>>>>>.