+ Reply to Thread
Results 1 to 5 of 5

Thread: security concern

  1. #1
    garikr's Avatar
    garikr is offline x10Hosting Member garikr is an unknown quantity at this point
    Join Date
    Aug 2009
    Posts
    46

    security concern

    I have a simple php/mySQL project, there is a file with a few constants which I include on every page. Among other things it contains mySQL password. Recently I've realized that it was accessible by everyone and changed it's permissions to 600. Is that enough? What's the best way to store passwords of that nature?
    P.S. Sorry if I've posted this in the wrong place.

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,267

    Re: security concern

    Create a directory

    /home/garikr/includes (or name of your choice)

    and store the file there. That way, Apache will not be able to serve the page directly
    Nothing is always absolutely so.

  3. #3
    garikr's Avatar
    garikr is offline x10Hosting Member garikr is an unknown quantity at this point
    Join Date
    Aug 2009
    Posts
    46

    Re: security concern

    Ty. So if I uderstand this correctly the apache access the folders as Other and php can access any file in my hosting derrictory. Can I set up a derrictory accesseble to only users, registered on my site? Maybe set up a Workgroup somehow. Can appache access folders with alternative credentials?(with Workgroup access as opposed to Other). Hope I'm making sence.

  4. #4
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,267

    Re: security concern

    Apache can only 'see' into public_html and subdirectories.
    It does so as 'other' (ie neither owner or group) so it cannot serve a file with 0770 permissions.
    When it executes a script (php, perl, python) it does so as the owner of the script. So a script with 0700 permissions will execute.
    PHP can include any file /home/yourusername and subfolders.

    You can password protect directories in Apache. Anyone trying to directly access a page in the directory will have to supply a username/password combo that has been stored. ie, www.foo.com/secret/ can be protected. Users only have to supply the username/password once per session. It unlocks the entire directory, not just the first file requested.
    Nothing is always absolutely so.

  5. #5
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,410

    Re: security concern

    What you can do, to protect a file that needs to be included everywhere, is to add something along the line of
    PHP Code:
    if (!defined('SECURITY')) {
        exit(
    "This is not an entrypoint");

    And then add
    PHP Code:
    define('SECURITY'true); 
    at the top of each page that includes the protected page.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

+ Reply to Thread

Similar Threads

  1. Advert Concern; Question about suspension
    By zapperpost in forum Free Hosting
    Replies: 6
    Last Post: 06-05-2008, 06:56 PM
  2. Advertisement Concern (Corporate Plan)
    By zapperpost in forum Free Hosting
    Replies: 4
    Last Post: 04-25-2008, 06:33 PM
  3. Concern regarding my website
    By UndercoverAndrey in forum Free Hosting
    Replies: 5
    Last Post: 11-11-2007, 07:06 PM
  4. Slight concern
    By cold_fusion in forum Free Hosting
    Replies: 1
    Last Post: 10-25-2005, 08:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers