If I give execute permission for a shell script but not read permission to others, they are unable to run the script. Is there a way I can have users run a script but not see its contents?

  • I was able to get it to work on a dummy account on Windows 10 by disabling security inheritance and then i.imgur.com/TPIqCjs.png and then setting the traverse folder / execute file permission. I had to right-click and run as administrator on the script though before it actually worked. Not sure if that'd suffice but easy enough for you to test in your environment assuming you're referring to a Windows system here. You might consider setting up a proxy account and a saved credential, etc. and have the user execute the script as the proxy with some testing,etc. this should be possible. Aug 25 '17 at 13:54
  • 1
    The best you can do is to obfuscate it. Search for "bash script obfuscator" and you will get plenty of links.
    – AFH
    Aug 25 '17 at 13:59
  • Possible duplicate of Avoiding users to corrupt and use a script
    – Scott
    Jul 28 '18 at 19:49

No. In order to execute the script, one has to be able to read it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.