First Method:
You can use ecryptfs-utils
sudo apt-get install ecryptfs-utils
After installing, run the commands below to create your encrypted private folder.
ecryptfs-setup-private
You’ll be prompted to create a ‘Mount Passphrase’. The first prompt is for your login password. The one you use to login, type that to continue. Next you’ll be prompted to create a Mount Passphrase. This is the one you’ll use to recover your data at a later date.
Another method: Compressing Trick method
You don't have to use any third-party software, we will just use the archive manager to compress the file or folder and lock it with a password so that you disallow unauthorized users from copying your contents.
Right click on the file(s) or folder(s) and select Compress:
In the window that will appear, select a compression format (7z, zip, tar, etc.), then click Other Options:
Enter any password of your choice, check on "Encrypt the file list too", then click Create:
You have now compressed and password-protected your file/folder. No user can now extract the archive file unless he/she provides the correct password:
More Advanced Options
If you want to prevent other users from deleting or moving the password-protected archive file you have just created, open the terminal and cd to where it is stored, then run this command:
sudo chattr +i file-name.ext
To undo this, enter this command:
sudo chattr -i file-name.ext