Compiling your code from the terminal directly into object (.o
) files is a decent method, but the main problem I see with it is that while object files are harder to reverse engineer than source code, they can still be analysed through specific reverse engineering techniques.
So if other root user could manage this, they could inspect these files, even if they don’t have access to your original code.
But because you want to compile the program on the server, just as you suggested, encrypting the source code and then decrypting it with a password inside a bash script for compilation would work well.
Tools such as openssl
can be used to encrypt your source code.
Using openssl, something like the following code might do the trick:
openssl enc -aes-256-cbc -salt -in example.f90 -out example.f90.enc -k yourpassword
And obviously this needs to be executable, as well.