An Easy Way to Hide Files and Directories 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.95/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...

7 Responses

  1. Mark Stephen says:

    Hiding files in Linux was not as easy as it looks. I really like your process to delivering that idea. your idea completely helps me…

  2. ghost74 says:

    Hello mate it is not append a dot the word should be “prepend” so that it’s​ easily understood by all

  3. Keith says:

    Appending a . may hide from ls, but it’s not really hidden from other users if they can perform ls -a. And password protecting a compressed file offers minimal security, as they can still read the file, and try to crac it.

    If you really want to hide files or folders from other users, you need to place them in a directory and chmod said_directory with 700. Other users can see that you have a directory named said_directory, but the will have no permission to view anything inside, truly hiding those things you don’t want them to see.

    • Aaron Kili says:

      @Keith

      This is true, we’ll include this in the article. Many thanks for this handy tip.

    • Tim D says:

      In case anyone’s interested, I wrote a couple functions to help quickly lock and unlock folders using chmod 700 method above:

      #————————————————————–#
      lockit() {
      sudo chown root:root $1
      sudo chmod 700 $1
      }

      unlockit() {
      sudo chown dmitri:dmitri $1
      sudo chmod 770 $1
      }
      #————————————————————–#

      You can then lock from the terminal:

      $ lockit path/to/dir_or_file
      

      In order to make your locked directory accessible again, run this from the terminal:

      $ unlockit path/to/dir_or_file
      

Got something to say? Join the discussion.

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