During the development of a script, some bugs remain "latent" until the script is run by a different user. (For example, the script may access a file that only the person developing the script has access to.)
Is there a way to run the script with the same privileges that the "intended user" of the script would minimally have?
(Please note the question's wording. I specifically avoided writing "user with minimal privileges", because in some cases the "intended user" may be expected to more than "minimal privileges". The case that most readily comes to mind is the one where the "intended user" is expected to belong to a specific group.)
Of course, one simple solution would be to create a dummy user with the desired privileges, but this solution requires having user-creation privileges, which is not always the case. I'm interested in solutions that could be used even when creating a dummy user is not an option.