To add to @nohillside answer you can share a FAT32 formatted drive but not set permissions as the filesystem doesn't support it.
If you want to control access to files on the USB by permissions then format it using a filesystem that supports it (such as HFS) and changes will be avaliable in File Sharing.
Yes, you can do it. You don't need to logout as both the GUI and the shell allow you to choose a different user to run in a non-admin account.
When it pops up for a password in GUI, enter the short echo $USER or long (what it shows in top right corner) admin account and then the admin password.
In terminal type, su username where username is your admin ...
The defaults command normally writes an entry into the relevant .plist file. The whole point of property list files is to retain settings between boots. You should not need to re-apply them after each boot.
Consequently, you should not need to run the defaults command in a .bashrc file, which runs at the start of every interactive shell session.
You should ...
The easy way is to turn off sandboxing for the app, in Xcode project settings under "capabilities". You might not want that though.
Otherwise you probably need a security-scoped bookmark to the directory. When you get access, create a bookmark from the directory URL using bookmarkData(options:includingResourceValuesForKeys:relativeTo:). Make sure to use ....
I suggest that you use the export function of photos.
from the photos app
.. be sure you click on the photos tab
.. command+a to highlight all photos
.. click on file
.. click on export
.. export ... [ you can pick either of the first two. I don't know what you might want. If you have made photo edits in photos, you want the first one. ]
if you ...
The tool chown isn’t good for this. Instead use sudo -s to be root. Now you’re the owner of the root directory.
If you want to ask a follow on question showing a specific path and specific command you get a specific error, there might be a better way to set things up - root won’t help with system read only files and the restricted flag in System Integrity ...