How to Lock Files

It is not possible! I deleted a file by mistake. A file I needed! Oh my God, I should kill myself for the stupidity I did! Relax, nothing is lost: by resorting to the use of some special programs, such as the ones I pointed out to you in my guide on how to recover files deleted from the Recycle Bin, you can be able to deal with it in a flash. For the future, though, let me give you some advice: worry about lock files relevant to you. In this way, you will avoid encountering various scares and unnecessary waste of time.

How do you say? The thing interests you (and also a lot) but you don't have the slightest idea how to do it? No problem, I can not explain it. Give me five minutes or so of your free time and I will show you how to succeed in the enterprise on both Windows and Mac, using the system's standard functions, so to speak or, alternatively, using software. of third parties. In all cases, you have absolutely nothing to worry about as the steps to be taken are within the reach of anyone, even those who, a bit like you, do not consider themselves a "geek".

Come on then, let's not waste any more time chatting and immediately start to get busy. Position yourself comfortably in front of your trusted computer and read very carefully all the instructions on what to do that you find below. I am sure that in the end you will be able to feel happy and satisfied with what you have learned and that if necessary you will be ready to provide useful explanations about it to all your friends. What do you say, we bet?

Lock Files on Windows

Are you using a PC with Windows installed and would you like to understand how to lock files? Then read the instructions you find right below. To do this, as anticipated at the beginning, you can use both the functions already included in the system or third-party tools. The choice is yours.

"Standard" Functions

I'm sure you were not aware of it but you should know that Windows integrates some special features thanks to which it is possible to lock files (but also folders) so that they are not deleted and modified, neither intentionally nor accidentally. Contrary to what you might think, using the aforementioned functions is very simple. Let's see immediately how to proceed.

First of all, locate the file (or folder) in relation to which you intend to go and right-click on it and then choose the item Property from the context menu that pops up. In the window that you will see appear on your desktop, select (if it is not already checked by default) the box next to the item Read only che trovi in ​​corrispondenza della dicitura Attributes: at the bottom and click on the button Apply.

At this point, select the tab Safety and press pulsating Edit ... placed at the top. Then select the name of your user account or the reference one and check the box next to the item Nega che trovi in ​​corrispondenza della dicitura Writing in the section below. Finally, press on the button Applyon that one Si in response to the warning that appears on the screen and then on OK for two consecutive times. Done!

Now, trying to delete the reference file (or folder) you will see a warning appear on the screen that will warn you that it is a protected item and therefore it is not possible to continue with the operation.

If you then have to think again, just access the properties of the security files again as seen together and remove the check from the box next to the item Nega in correspondence with the wording Writing. Then remember to confirm the changes again by pressing on Apply and OK. Also remember to remove the check from the box next to the item Read only in the tab General properties of the file (or folder) and save the changes by clicking on Apply and OK.

fsLock

If, on the other hand, the standard functions do not satisfy you and you prefer to resort to the use of third-party tools, the suggestion I would like to give you is to test fsLock. It is a completely free program that allows you to lock a file (or a folder) to prevent it from being deleted, modified, renamed or moved to another location on your computer. In short, it is software that “paralyzes” a file and keeps it safe. And if you try to delete it, Windows prevents you.

To use it, first connect to the download page of the program on the Softpedia website and press the button Start Download top left. Then click on the button Softpedia Mirror (US) in the box that appeared on the screen and wait for the download to start and complete.

Then extract the ZIP file obtained in any Windows location and open the file contained within it. Then click on Next, select the voice I Agree and then click on again Next three consecutive times. Finally, first press on Si and subsequently on Close.

To start fsLock, double click on its icon that has been added to the desktop. To lock a file and prevent it from being renamed, deleted, modified or moved, click on the item Fillet in the upper left of the program window, choose Add Files… from the menu that opens and select the reference file. To do the same thing with an entire folder, click on the item Add Directory… from the menu and select the reference item.

To start fsLock protection, you just have to open the menu Engine (always located at the top left) and click on the item Start…. After a few seconds the fsLock protection will come into play and trying to intervene on the protected file Windows will not allow it.

To make fsLock save the list of files to be locked (it is lost if you close the program), go to the menu Fillet and click on Save…: in the window that opens, give your list a name and click on the button Save. Do the same every time you add new files to protect in the list.

Also note that it is usually not possible to view files while fsLock is protecting them. To disable the protection, just go to the menu Engine and click on the item Stop….

System Protect

Another great program that you can use to lock files (and folders) on your Windows PC avoiding deletion and other changes is System Protect. It works in the background, allows you to choose which files should not be deleted, either manually or through any processes, and by default also does the same with important system files. It's free and it's not difficult to set up.

To use it, first download the program by connecting to the download page of the same on the Softonic website, by clicking on the button Free Download which is at the top right and then presses the button Alternative Download attached to the new page that opens.

At the last download, start the executable file obtained, click on Si and subsequently on Next. Then check the box next to the item I Accept the agreement. Install System Protect on all accounts on my computer. and presses up again Next then remove the check mark related to the installation of toolbar and various additional programs and click again on Next. Therefore, complete the setup by pressing on Finish.

Now that you see the program window on your desktop, select the tab Custom Protection present on the left, presses the button Add File which is at the bottom to add the file you want to block, preventing any type of modification or cancellation or, alternatively, presses the button add Folder to select an entire folder and then click on Close, in order to close the software window and make sure that the changes are applied.

If you then have second thoughts, you can always and in any case remove files and folders added to the list by selecting the reference element and clicking on the button Remove Seelcted. To remove all protected items in one go, you need to click the button instead remove All.

If desired, you can also set a password to protect the operation of the program so that unauthorized third parties can make any changes to its operation. To succeed, click on the tab Setting on the left, check the box next to the item Protect this Application by password and type the password you want to use in the two fields below then click on the button Save to confirm and apply the changes.

Also from the section relating to the program settings, I point out the possibility to choose whether to make System Protect run automatically when Windows starts or not. By default the option is enabled but if you want you can disable it by simply unchecking the box Show System Protect Start Up Window.

Lock Files on Mac

Are you using a Mac and would like to understand how to lock files (and folders) in order to avoid accidental deletion as well as any other unwanted modification? In this case, I would like to point out that unfortunately there are no third-party tools used for this purpose (or in any case those few in circulation are not really functional and / or compatible with the most recent editions of macOS).

However, this does not mean that you cannot succeed in your intent. In fact, you just need to take advantage of the features included as standard to be able to meet your needs. All you have to do is type in a very simple command from terminal. Let's see in detail how to proceed.

First, open the Terminal by clicking on its icon attached to Launchpad (you find it in the folder Other), in the folder Applications (in the subfolder Other) or, again, call it back via Spotlight or by Siri. Once the relevant window appears, enter the command sudo chmod +a “everyone deny delete”, leave a space after the first quote and type the path relative to the reference file (or folder). If you don't feel like typing the entire path by hand, drag the file or folder directly into the Terminal window to insert it automatically.

Then press the button Submit on the keyboard, type the password for your user account and then press the key again Submit always present on the Mac keyboard. And here it is!

Once this is done, trying to delete or modify the reference file (or folder) the action will be blocked unless you enter the password for your user account in the window you will see on the screen.

In case you have to think again and want to restore the "normal" functioning of the file (or folder), just right click on it, choose the item Get information from the menu that opens, locate the section Sharing and permissions: which is at the bottom of the new window displayed on the desktop and expand it (if it is not) by clicking on the relative dart.

In the table below you will then need to identify the user everyone present in the column Name and select from the menu under the column Privilege the option Reading and writing.

In the event that trying to carry out the above steps a warning appears indicating that you cannot make changes to the permissions of the reference file (or folder), first click on the symbol of the padlock which is at the bottom right of the info window of the selected element and type the password of your user account in the additional window that appears in order to enable the changes to be made.