Take the 2-minute tour ×
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.

I know it sounds strange, but is there a good tool that compiles a shell (.sh) script into a executable format? I want to protect the script in such a way it will not be modified by someone.

Thanks

share|improve this question
5  
What is the underlying problem you are trying to fix? –  mdpc May 14 '14 at 1:55
    
i found 1 on this link (datsi.fi.upm.es/~frosal) but i can't find a way how can i install the shc-3.8.9.tgz file, my main concern is that i want to secure the code for version control purpose. –  batil May 14 '14 at 6:08
    
I have seen such things before, they do not "compile" anything. Basically, these things generate a wrapper program reading in the program from the data within the single file and using a subshell for each coded command. It's not really worth the effort and can cause substantial loss of speed as well as compatibility between system releases, and other linux/unix based systems. –  mdpc May 14 '14 at 8:27

2 Answers 2

up vote 2 down vote accepted

You can prevent MODIFICATION by setting the .sh file(s) to have READ/EXECUTE access to everybody. (i.e. chmod 555 filename.sh) Even then, the owner and root (and anybody with WRITE access to the directory) will always be able to make modifications to the .sh file.

share|improve this answer
    
will consider this. thank you @mdpc –  batil May 23 '14 at 0:58

You can try chattr +i <script name>, set the script owner as root, and give it read / execute permissions.

Once this flag is set to the script, only root will be able to edit it (after running chattr -i <script name> )

More info can be found here: http://computernetworkingnotes.com/managing-file-system-security/chattr.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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