I'm logging in via SSH as root, and then using a script to sync a directory with a cloud storage service. The trouble is, all the files created by the script then belong to the root user.
When I then try over SMB to manage these files, I'm told I don't have sufficient permissions. I then execute chmod -R 777 on that folder and that fixes the problem, but this is a hassle to do every time.
Is there a way to designate the folder as belonging to a certain user or to always have certain default permissions so that new files have those permissions as well?