Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 01:08:04 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155557 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: CHECK your rights, permissions, chmod, ftpuser, webuser  (Read 4483 times)
pcwacht
Guest
« on: September 25, 2006, 09:18:32 PM »

Just make a code section paste the code and call the page where it is in

Code:
function check_dir($path) {
   echo "<h1>checking: ".$path."</h1>";
   $dh = opendir($path);
   while (($file = readdir($dh)) !== false) {
      if ($file<>'.' && $file<>'..') {
         if (is_dir($path.'/'.$file)) {
            check_dir($path.'/'.$file);
         } else { 
           if (is_writable($path.'/'.$file)) {
              echo 'Green :'.$file.'<br>';
           } else {
              echo '#### Not ok! :'.$file.'<br>';
           }
         }
      }
   }
   closedir($dh);
}

check_dir('../temp');
check_dir('../templates');
check_dir('../pages');
check_dir('../languages');
check_dir('../media');


Works on Linux, not confirmed on windows

Have fun,
John
Logged
kweitzel
Forum administrator
*****
Offline Offline

Posts: 6977


WWW
« Reply #1 on: September 26, 2006, 09:30:57 AM »

Great Script ... works fine on my production host (Linux). On XAMPP it gives errors. Buit I think we can forget about them smiley

cheers

Klaus
Logged

WebsiteBaker Org e.V. - for WebsiteBaker

pcwacht
Guest
« Reply #2 on: September 26, 2006, 01:18:54 PM »

Windows - Xampp users hardly ever have persmission problems Wink

This script just check to see if the WEB user has permissions to write/create/delete files


I like it allso, it is short, fast and easy enough to understand... Wink


Oh did I mention I wrote it?


Tongue
Tongue

John
Logged
kweitzel
Forum administrator
*****
Offline Offline

Posts: 6977


WWW
« Reply #3 on: September 26, 2006, 05:02:57 PM »

good question ... who wrote it ? huh evil

cheers

Klaus
Logged

WebsiteBaker Org e.V. - for WebsiteBaker

kweitzel
Forum administrator
*****
Offline Offline

Posts: 6977


WWW
« Reply #4 on: September 28, 2006, 07:41:53 PM »

Hi John,

put an initial Page with this script into the WIKI: http://projects.websitebaker.org/websitebaker2/wiki/Docs-EN-Advanced-Howtos-Filepermissions

Would you please chek and eventually correct me? Thanks

cheers

Klaus
Logged

WebsiteBaker Org e.V. - for WebsiteBaker

pcwacht
Guest
« Reply #5 on: September 28, 2006, 07:56:52 PM »

Code:
If you use it on a HTML Page you need to wrap ....

Many servers can't handle php inside html pages,
they can inside php pages... Wink


This script will only work at a defualt installation (the pages dir for example) and only when the code is put in a firstlevel page
If not the path (../) might be changed to ../../ (if the page wich hold the code is on the irst sublevel)

Maybe note this somewhere
Or change last bit to:
Code:
$path = '../';   // first level page with code
check_dir($path.'temp');
check_dir($path.'templates');
check_dir($path.'pages');   // default pages dir!
check_dir($path.'languages');
check_dir($path.'media');

Thanks for porting the info btw... I like those wikis wich explain stuff Wink

John
Logged
kweitzel
Forum administrator
*****
Offline Offline

Posts: 6977


WWW
« Reply #6 on: September 28, 2006, 08:57:25 PM »

Quote
Many servers can't handle php inside html pages

OK ... fair comment ... removed it.

Quote
This script will only work at a defualt installation (the pages dir for example) and only when the code is put in a firstlevel page

added that info as well ...

cheers and thanks for the corrections

Klaus
Logged

WebsiteBaker Org e.V. - for WebsiteBaker

valerie

Offline Offline

Posts: 156


WWW
« Reply #7 on: September 29, 2006, 06:28:42 PM »

What should you do when it comes back with a list of around 60 items that are "not ok!"?

I've been having trouble with different permissions on some files/folders in wb so based on woudloper's advice I asked my host to change all permissions. But if I understand correctly, this means that now they don't have the permissions wb needs. I'm not sure what to do...
Logged

http://www.robcomm.net
--editing and proofreading for American English
--print and web publication management
--graphic and web design, including original photography
Spritemarkiv
AddOn Development
*
Offline Offline

Posts: 113



WWW
« Reply #8 on: August 08, 2008, 03:54:59 PM »

The part about placing the page in the first level should be on the Knowledge Base. Took me a long time to get it to work. sad Now working after digging around and finding this topic.
Logged
Argos
Moderator
**
Offline Offline

Posts: 2161


WWW
« Reply #9 on: August 23, 2008, 11:04:38 AM »

I made some changes in the visual aspects:
Code:
echo "<h1>Checking permissions</h1>";
function check_dir($path) {
   echo "<h4>".$path."</h1>";
   $dh = opendir($path);
   while (($file = readdir($dh)) !== false) {
      if ($file<>'.' && $file<>'..') {
         if (is_dir($path.'/'.$file)) {
            check_dir($path.'/'.$file);
         } else { 
           if (is_writable($path.'/'.$file)) {
              echo '<font color="green">'.$file.'</font><br>';
           } else {
              echo '<font color="red">'.$file.'</font><br>';
           }
         }
      }
   }
   closedir($dh);
}

check_dir('../temp');
check_dir('../templates');
check_dir('../pages');
check_dir('../languages');
check_dir('../media');

However, I don't understand what's the purpose of this thingy. It seems files only get approved if they are writable, but that's not needed for many files, is it?
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #10 on: August 23, 2008, 11:14:03 AM »

Nope, not needed
But on some directories they really are needed,
temp, templates, modules etc etc

This thingy just checks php rights on them, thus testing apache rights


John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!