Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 590767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:33:51+00:00 2026-05-13T15:33:51+00:00

Ok, is there a way for the PHP user (www-data) to gain access to

  • 0

Ok, is there a way for the PHP user (www-data) to gain access to other parts of the server, for example, /home/username/another_folder/ ?? Thanks in Advance.

Will

EDIT: Do I just add www-data to another group?? Or something like that, or is there another way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:33:51+00:00Added an answer on May 13, 2026 at 3:33 pm

    You can create another group and add the www-data (if your webserver runs under www-data user) to this group, then assign this group to all those files you want to be accessible.

    Or if you just need the read permission, and it is not an issue that other users on the system have read access to your files, then just change permissions of your files (in other places) to have the read permission for other. For example, 775 for your directories and 644 for your files.

    Remember that you can not serve pages in places other than your Document Root (for example /var/www), even though your webserver user has the permissions to access those files.

    However if you configure “aliases” or “virtual hosts” for your web server, you can make places other that your default document root, accessible by HTTP requests.

    But PHP files that are under your document root and executed by the web server, CAN read contents of files outside the document root IF the web server user has enough permissions.

    // file permissoins
    /tmp/shared_by_all.txt -> 644
    /home/user1 -> 751 or 755
    /home/user1/shared_by_all.txt -> 644
    /home/secureuser -> 750
    /home/secureuser/myfile.txt -> 640 (or even 644 because of the containing directory permissions, other can not even enter the directory tree. so file is not accessible)
    
    
    // file: /var/www/read_file.php
    <?php
        echo file_get_contents('/tmp/shared_by_all.txt'); // ok!
        echo file_get_contents('/home/user1/shared_by_all.txt'); // ok!;
        echo file_get_contents('/home/secureuser/myfile.txt'); // fail!;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to restrict access to a specific webpage such as http://www.example.com/subpage
IN PHP: Is there a way for the user to fake a session variable?
Is there a way to create a link like www.facebook.com/wallpapers.3d in order the user
Is there a way with PHP to show 2 (or x) decimal places, but
Is there a way in PHP 5.3 to get crypt() blowfish (salt starting with
Is there a way in php to count how often a value exists in
I was wondering is there a way in PHP that you could tell where
Is there a straightforward way in PHP to get an arbitrary complex value into
Is there a way to run PHP 5.3 next PHP 5.4? I'd like it
Is there any way to include php file using require and calling a php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.