Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

This question already has an answer here:

How can I create a password-protected shell script for read/write access. It should also be executable by all users without the password. I have sensitive information in the script.

share|improve this question

marked as duplicate by Stéphane Chazelas, rahmu, vonbrand, Ulrich Dangel, jasonwryan Apr 8 '13 at 18:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

What sort of sensitive data are you putting in a shell script? Avoiding that in the first place seems like a better goal. – Mat Apr 8 '13 at 5:38
Kind of password. – Maniv G Apr 8 '13 at 5:39
Then you really, really shouldn't have that in a script. Can't you use sudo? Or passwordless SSH? Please give more info. – Mat Apr 8 '13 at 5:40
I think sudo will not be suit in my case. Well, my script is in /etc/ And i'm authenticating the user based on his password to create/move a file and logging that info in a script So, there is a possibility that other users also can see what the script is doing. So, i just need to hide the script's content from reading or writing. – Maniv G Apr 8 '13 at 5:44
Don't post the same question on multiple sites:… – Matteo Apr 8 '13 at 5:56

1 Answer 1

up vote 2 down vote accepted

You will not be able to hide information in a shell script. To be execute the shell will have to be able to read the content. In a way or the other the user will be able to do the same.

share|improve this answer

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