Search code examples
bashenvironment-variablesinstallationdrivereula

Shell driver install with `ACCEPT_EULA=Y` error


As described here, I am trying to install the following driver in shell, using this code (modified from the original slightly):

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/debian/8/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql17

But I get an error on the last command:

sudo: sorry, you are not allowed to set the following environment variables: ACCEPT_EULA

After searching, I can't seem to find this exact error anywhere else.

One solution is to run the last command without ACCEPT_EULA=Y as sudo apt-get install msodbcsql17. And then to enter Y at the prompt. This indeed works but I would like to run the above installation for other users without need of their input.

  • Is there a way to resolve the above error so I can use ACCEPT_EULA=Y, or
  • alternatively is there a simple way to enter the Y response for the EULA automatically so the end user never needs to take any action?

Thank you in advance.


Solution

  • You appear to have access to run arbitrary commands, but not to modify the environment.

    The simple workaround is to hand off environment changes to the command:

    sudo env ACCEPT_EULA=Y apt-get install msodbcsql17