title: Using mkdir in my bash script and getting permission denied
body: <p>i have script that is owned by root in a directory owned by root. part of the script is to make a directory that will hold the inputs/outputs of that script. i also have a sim link to that script so any user can run it from anywhere. i don't use the temp directory so this info can be used as logs later.
  Problem: when a user tries to run the script they get an error that the directory cannot be created because of permission denied.
  Questions: why won't the script make the directory so root owns it independent of what user runs it? how can the script make the directory so root owns it instead of the user that ran it? only the script needs this info, not the user. </p>
  
  <p>Additional info:
  the directory is: drws--s--x.
  the script is: -rwxr-xr-x.
  (if you need to know) the line in the script is simply: mkdir $tempdirname</p>
  
  <p>i am matching the permissions of other scripts on the same server that output text files correctly, but since mine is a directory i'm getting permission errors.
  i have tried adding the permissions for suid and sgid. suid sounded like the correct solution since it should make the script run as if it were run by the user that owns the script. (why isn't this the correct solution?)</p>
  
  <p>i would like any user to be able to type in the sim link name, that will run the script that is owned by root in the directory that is owned by root, and the directories created by that script will stay in its own directory. and the end user has no knowledge or access to the inner workings of this process. (hence owned by root)</p>