Jump to content
Sign in to follow this  
geoffreywalton

Checking File Permissions

Recommended Posts

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

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 ======>>>>>.

Share this post


Link to post
Share on other sites

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.oscommerce.com/community/contributions,2137

it s more graphic but go less deeper !


MS2

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 ======>>>>>.

Share this post


Link to post
Share on other sites

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 ======>>>>>.

Share this post


Link to post
Share on other sites

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

 

 

 

 

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 © 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 ======>>>>>.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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 ======>>>>>.

Share this post


Link to post
Share on other sites

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 ======>>>>>.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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 ======>>>>>.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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 ======>>>>>.

Share this post


Link to post
Share on other sites
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

 

Thanks, I'll dig around in there.

Share this post


Link to post
Share on other sites

Found a bit missing as well... look in the admin\check_permissions.php file for:

 

$backup = $_POST['backup'];

$temp = $_POST['temp'];

 

and put in the middle line to make it:

 

$backup = $_POST['backup'];

$download = $_POST['download'];

$temp = $_POST['temp'];

 

Which should make it so that running this doesn't kill your downloads folder anymore. Noticed that it couldn't set the permissions on the file partway through.

Share this post


Link to post
Share on other sites
Warning: chmod() [function.chmod]: Operation not permitted in /home/jwewbro1/public_html/admin/check_permissions.php on line 326

 

 

same problem - did you find a solution to it ?

Share this post


Link to post
Share on other sites

What are the current permissions on the file?

 

Do you have permissions sufficient to change the permissions?


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 ======>>>>>.

Share this post


Link to post
Share on other sites

>>What are the current permissions on the file?

 

the php file itself got even 777 for testing purposes.

 

>>Do you have permissions sufficient to change the permissions?

 

well, using FTP, sure, but I am not sure how to verify if the PHP engine is allowed to use chmod , may that be the issue ?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×