Hello,
You just need to allow Terminal app to perform such modifications.
I've tried the following and it worked like a charm 😇: Pull down the Apple menu and choose ‘System Preferences’
Choose “Security & Privacy” control panel
Now select the “Privacy” tab, then from the left-side menu select “Full Disk Access”
Click the lock icon in the lower left corner of the preference panel and authenticate with an admin level login
Now click the [+] plus button to add Terminal application with full disk access,(App to fetch from Application folder).
Enjoy a break