code: public static void setScriptPermission(InstanceConfiguration config, String scriptName)
      {
          if (SystemUtils.IS_OS_WINDOWS)
          {
              // we do not have file permissions on windows
              return;
          }
          if (VersionUtil.isEqualOrGreater_7_0_0(config.getClusterConfiguration().getVersion())) {
              // ES7 and above is packaged as a .tar.gz, and as such the permissions are preserved
              return;
          }
          
          CommandLine command = new CommandLine("chmod")
                  .addArgument("755")
                  .addArgument(String.format("bin/%s", scriptName));
          ProcessUtil.executeScript(config, command);
  
          command = new CommandLine("sed")
                  .addArguments("-i''")
                  .addArgument("-e")
                  .addArgument("1s:.*:#!/usr/bin/env bash:", false)
                  .addArgument(String.format("bin/%s", scriptName));
          ProcessUtil.executeScript(config, command);
      }
docs: Set the 755 permissions on the given script.
  @param config - the instance config
  @param scriptName - the name of the script (located in the bin directory) to make executable