How To Hide A Folder Or File Under An Image In Linux

  • 489
  •  
  •  
  •  
  •  
  • 2
  •  
  •  
    491
    Shares

Everyone faces a time where they have to hide stuff from others. Well everyone knows the classic way of hiding files deep inside a folder but in some cases it might not be enough to keep smart people from peeking on your files.  In this case, hiding your files under an image might work fine.

Before we start, create a directory containing an image file (.jpg or .png ), and the file or folder you wish to hide. Just for our example, we are going to hide a directory of files, named secret_files. Our original image file is htg-site.png. We use the cd command to change to the directory that has the image and the file or folder to be hidden.

cd files_to_hide/

how-to-hide-a-folder-in-a-pic

We will now create compressed file that has the directory we want to hide in the image. To do this, we type the following command in the shell.

zip -r secret.zip secret_files/

In the command above, -r will include all the subdirectories that are within the specified directory in compressed file. The name of the compressed file we choose is  secret.zip and the name of the directory that it is to be compressed is secret_files.

When you are back at the command prompt, type ls . You will now see the  secret.zip file listed.

how-to-hide-a-folder-in-a-pic-2

Now, we are going to add the compressed file and image file together, and save the result as a new image file using the cat command. In our example, we type the following command at the prompt.

cat htg-site.png secret.zip > secret.png

First the original image file must be listed before the compressed file name you want to insert into the image file. Then, we direct the original image file and the compressed file to form a new image called secret.png .

While using the ls command at the prompt, you will see the new image file with the name secret.png , which is hiding the compressed file. You can now display new image using any image viewer.

Once you have your new image which hides your folder or file, you can delete the compressed file and the original file, using rm command. In our example, we went with the following two commands to delete our compressed file and the original folder.

rm secret.zip
rm -r secret_files

 

Now to access the hidden folder again, make sure you are in the directory that the image in which your file or folder is hidden. Now, extract the file or folder from the image by typing the below command.

unzip secret.png

Substitute the name of your image file with secret.png in the above command.

how-to-hide-a-folder-in-a-pic-3

Our secret_files directory is available again, and when we change to that directory ( cd secret_files/ ), and list the files ( ls ), we see our original files.

This  is not necessarily the most secure way to protect your files. It just makes them less obvious to someone poking around your system.

The following two tabs change content below.

Unallocated Author

Please note that the article you are reading has an unallocated author as the original author is no longer employed at latesthackingnews.com, this has been put in place to adhere with general data protection regulations (GDPR). If you have any further queries, please contact: [email protected]

Unallocated Author

Please note that the article you are reading has an unallocated author as the original author is no longer employed at latesthackingnews.com, this has been put in place to adhere with general data protection regulations (GDPR). If you have any further queries, please contact: [email protected]

Leave a Reply