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.
Asked
Active
Viewed 2,866 times
2
-
3What 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
-
1Then 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
-
2Don'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 Answers
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,676
- 4
- 49
- 66