How to Create a Shared Directory for All Users in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

12 Responses

  1. Evi1M4chine says:

    What if a user copies or moves a directory tree from his home directory to the shared one?
    I don’t think the subdirs will magically change their group, let atone recursivelyy because they are not newly created…

    • Aaron Kili says:


      That’s correct, including the recursive option allows subdirectories to be get top directory permissions automatically. Many thanks for the heads up.

  2. Iulian Murgulet says:


    I think that you do not need 2775. More secure is to use chmod -R 2770. In this case only the desired users/group can access this shared folder, and any others will not have access.

    • Aaron Kili says:


      Yap, your correct, we should have used chmod -R 2770, other system users will be blocked from accessing a shared directory. However, always set permissions depending on your environment needs.

      • José Luis Pérez says:

        In my case, i needed the shared folder were shared also with apache. I had to use “chmod -R 2775”. If I used “chmod -R 2770”, apache couldn’t access to the folders.

  3. Jalal Hajigholamali says:

    Thanks,Very useful material,
    I created shared directory under /opt

  4. Ray says:

    I assume that on your distro Apache has a base directory in /var/www unlike a distro like Fedora that starts in /var/www/html/. This would be good for users that want to build a web site together or share common reports over a web server. Another good option is to use ACL with the facl command.

  5. thomas h says:

    Very helpful for the novice admin.

    You should probably highlight that /var/www isn’t a good place to allow ‘regular users’ to store stuff unless you can guarantee it is on a separate filesystem than /var; should a user decide to fill it up system log files no longer can be written

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.