I'm using Microsoft's dotnet in linux (ubuntu), and it has dial-home telemetry. I want to disable it, and the instructions say:
The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous and doesn't include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
I've read that .profile
, .bashrc
, .bash_profile
, /etc/environment
, etc, have differences in when they are read, if at all.
So I'm not sure where to put DOTNET_CLI_TELEMETRY_OPTOUT=1
? I want it to always be loaded, regardless whether I login without desktop, login with desktop, ssh in remotely, start a terminal, start a terminal from a parent terminal, etc.
Which file (or files) should I put it in? And how would I do it for all users?
Best Answer
If you are using
Ubuntu
as one of your tags says, you'll have a directory calledAs
root
, create a file inside. Let's call itOpen it with a text editor and enter the following:
Uodate: You don't have to make the file executable. It's just a force of habit from my early Linux days. It doesn't hurt anything if you do, though.
Afterwards, you can log out and back in or:
And that will start a new shell session which sources
/etc/profile.d/dotnet_optout.sh
To confirm when you're done, enter:
You'll get an output of
1
.In short, any script that is executable by everyone who is using
bash
(or somesh
-like shell that sources/etc/profile
) that you put inside of that directory will affect everyone's environment.If you have users who use other shells, the configuration will be similar, but you'll need to update different configuration files.