I know this post is a few years old, however, it just happened to me in Catalina and @Matty's response led me to investigate into preferences.
To solve this problem, you have to go to System Preferences/Security&Privacy/Privacy
. Then from the left-hand side column, you have to choose Files and Folders
, then in the right side window, you will see which folders or files Terminal was trying to access and whether access was granted by check marks next to the File/Folder.
The File/Folder with no checkmark should be the one that you are receiving the Permission Denied
. To restore permissions, click the box next to the File/Folder in question.
Something to note in Catalina, apps that require access to your disk require your permission to access Files/Folders. So in the case of Terminal, if you are moving around directories a lot, you will be presented with dialog popups requesting you to give the app permission to access the contents. To save yourself this hassle, you can give the app access to the full disk, or you can limit its disk access. You have the power.