Tuesday, November 12, 2013

How to use SUID for shell scripts in Linux?

Question : How to write a shell script which will read the required passwords/connect strings from a config file? Other users should be able to execute the scripts, however they should not be able to read the config file.

Say, I have a config file, myconfig.txt, which contains credentials for an oracle connection:
$ cat myconfig.txt
SQLUSR="scott"
SQLPWD="pwd123"