Dinesh
Dinesh

Reputation: 177

Only a Set of shell script should execute a shell script

I have a shell script on /usr/bin/myapp and another 12 set of scripts on a diff folder (say /opt/myapp). I want a solution that only scripts from /opt/myapp can use or execute script in /usr/bin/myapp. This is to secure the script on /usr/bin/myapp and noone else except /opt/myapp should use it.

Any other solution is also accepted. Thanks in advance

Upvotes: 0

Views: 53

Answers (1)

Martin Väth
Martin Väth

Reputation: 236

The standard way is to grant "execute" permissions on the folder (or "read" and "execute" permissions on the scripts) only for a special group.

(Note that restricting "execute" permissions for the script alone is not enough, since read permissions are enough to execute a script with e.g. sh /path/to/script.)

Then you can grant the group permissions to the other scripts for instance via sudo (using some shell wrappers) or by writing your own binary wrappers.

Upvotes: 1

Related Questions