Is there a way I can password protect a folder without encrypting/compressing?

Solution 1:

You can just change the directories permissions to 700 (which equals to rwx------ which means no access at all for everybody, except full access for the owner).

That way, no normal user (except your user account!) can enter the directory. They will still be able to see the folder from the outside, but they neither can open it to list its content nor can anybody open files inside it, even if they know the full path and name.

However, when you are logged in and walk away, there is no protection, as this does not affect your own account. You can also decline your own account any permission (set to 000 then), but this can be reverted from your account without password, if one knows how to do so.

So the best option is to change the permissions to 700 (only owner has access) and additionally change the owner to be root. That way, nobody can enter the directory, not even you. And you can not change the permissions of the directory back.

To access your folder anyway, you would then have to be root, which requires one to be logged in with an admin account and to use gksu/gksudo to open a file manager or media viewers like Nautilus and VLC. This however prompts you again for your admin account password, so you are protected from anybody who is no admin and can not become root.

So how to set this up is ridiculously simple. Let's assume the folder you want to protect is /home/MYUSERNAME/Videos/private.

  • Option 1: Full access for owner (you), but no access for other accounts.

    chmod 700 /home/MYUSERNAME/Videos/private
    

    This setting can be undone from your account without password by typing

    chmod 775 /home/MYUSERNAME/Videos/private
    
  • Option 2: No access for any user including you, so you need to become root to enter the directory.

    chmod 000 /home/MYUSERNAME/Videos/private
    

    This can also be reverted from your account without password by

    chmod 775 /home/MYUSERNAME/Videos/private
    
  • Option 3: No access for any user including you and no chance to revert it from your account, so every action can only be performed as root.

    chmod 700 /home/MYUSERNAME/Videos/private
    sudo chown root: /home/MYUSERNAME/Videos/private
    

    To revert this setting, you have to do the following (which needs sudo and therefore requires your account password):

    sudo chown MYUSERNAME: /home/MYUSERNAME/Videos/private
    chmod 775 /home/MYUSERNAME/Videos/private
    

Note that options 2 recommends and 3 requires you to have an admin account and that all options only can protect you from users without admin accounts and passwords!

Additionally I should mention that one with enough experience and physical access to the machine can also boot it in recovery mode and be root user without having to enter any password. But there is no more secure way unless you use encryption, which you explicitly said you do not want.

Solution 2:

you can use steganography method its not also protect your files it also hide your files

https://scottlinux.com/2014/08/12/steganography-in-linux-from-the-command-line/

first install steghide

sudo apt-get install steghide

2nd

steghide embed -cf tux.jpg -ef mytext.txt 
Enter passphrase: 
Re-Enter passphrase: 
embedding "mytext.txt" in "tux.jpg"... done

to extract

steghide extract -sf tux.jpg
Enter passphrase: 
wrote extracted data to "mytext.txt".