2

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.

tshepang
  • 65,642
dm90
  • 123
  • 3
    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 08 '13 at 05:38
  • Kind of password. – dm90 Apr 08 '13 at 05:39
  • 1
    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 08 '13 at 05:40
  • I think sudo will not be suit in my case. Well, my script is in /etc/myscript.sh. 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. – dm90 Apr 08 '13 at 05:44
  • 2
    Don't post the same question on multiple sites: http://stackoverflow.com/questions/15871805/how-to-create-a-password-protected-shell-script – Matteo Apr 08 '13 at 05:56

1 Answers1

3

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.

Matteo
  • 9,796
  • 4
  • 51
  • 66