The full text of this error reads: Unable to open physical file … Operating system error 5: “5(error not found)” (Microsoft SQL Server: Error 5120), where the … will be replaced by the full path to the database you are trying to attach. I am not sure I will describe everything here perfectly down to the last detail, because I changed a lot of settings, so if this does not work for someone (or, on the contrary, does work), please let me know in the comments.
First I tried to set access permissions to the folders containing the mdf files for the NT ServiceMSSQLSERVER account, where MSSQLSERVER is the name of your SQL Server instance. The first thing you need to do is open SQL Server Configuration Manager and change the account under which the SQL Server (your_instance_name) service runs.
Select this service, right-click it, choose Properties, and on the Log On tab, in the Log on as: section, select Built-in account: Local System.

The next step is to set the correct permissions on the folder with the *.mdf files. I am not sure whether it helped that I granted Full Control + Ownership to the NT ServiceMSSQLSERVER account:

Because it only started working once I applied the same settings to the account I am logged in with (Radeksunamo):

After clicking Advanced, set the Owner to the account you are logged in with and try to add/attach the database. It should work now. Do not forget to check all the inheritance options – in my case it would not have much effect, because the folder with the DBs has no subfolders, but I always check them – you never know, and it is better to do things properly right away.