How to stop this permissions issue happening after an Archive & Install

Recently I had to perform an Archive and Install on my machine as it kept freezing, since doing this, however, it created a really annoying issue.  Whenever I tried to make a change to a file that existed on the desktop or documents folder before the re-install it would ask for my username and password. However, if I created a new document or folder, it would work fine.
permissions issue osx
I could not find a way to get around it and having to enter the details each time started to get on my nerves. Then  I realised that this was a permissions issue related to everything that was on the desktop prior to the re-install of the operating system.
After a bit of digging around, I discovered a simple terminal command as a workaround!
If you are experiencing this issue after a reinstall, then type in the following terminal command:

chmod -R -N

then enter either the path to the file or folder to drag the file to the terminal window, then test again.
I hope this helps with this really minor, yet annoying problem.