Skip to main content
added 67 characters in body
Source Link
Nasir Riley
  • 12.4k
  • 2
  • 26
  • 30

If you are using Ubuntu as one of your tags says, you'll have a directory called

/etc/profile.d

As root, create a file inside. Let's call it

dotnet_optout.sh

Open it with a text editor and enter the following:

#!/bin/sh

DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_CLI_TELEMETRY_OPTOUT

MakeUodate: You don't have to make the file executable by all:. It's just a force of habit from my early Linux days. It doesn't hurt anything if you do, though.

chmod a+x /etc/profile.d/dotnet_optout.sh

Afterwards, you can log out and back in or:

bash

And that will start a new shell session which sources /etc/profile.d/dotnet_optout.sh

To confirm when you're done, enter:

echo $DOTNET_CLI_TELEMETRY_OPTOUT

You'll get an output of 1.

In short, any script that is executable by everyone who is using bash (or some sh-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.

If you are using Ubuntu as one of your tags says, you'll have a directory called

/etc/profile.d

As root, create a file inside. Let's call it

dotnet_optout.sh

Open it with a text editor and enter the following:

#!/bin/sh

DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_CLI_TELEMETRY_OPTOUT

Make the file executable by all:

chmod a+x /etc/profile.d/dotnet_optout.sh

Afterwards, you can log out and back in or:

bash

And that will start a new shell session which sources /etc/profile.d/dotnet_optout.sh

To confirm when you're done, enter:

echo $DOTNET_CLI_TELEMETRY_OPTOUT

You'll get an output of 1.

In short, any script that is executable by everyone who is using bash (or some sh-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.

If you are using Ubuntu as one of your tags says, you'll have a directory called

/etc/profile.d

As root, create a file inside. Let's call it

dotnet_optout.sh

Open it with a text editor and enter the following:

#!/bin/sh

DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_CLI_TELEMETRY_OPTOUT

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:

bash

And that will start a new shell session which sources /etc/profile.d/dotnet_optout.sh

To confirm when you're done, enter:

echo $DOTNET_CLI_TELEMETRY_OPTOUT

You'll get an output of 1.

In short, any script that is executable by everyone who is using bash (or some sh-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.

added 73 characters in body
Source Link
Nasir Riley
  • 12.4k
  • 2
  • 26
  • 30

If you are using Ubuntu as one of your tags says, you'll have a directory called

/etc/profile.d

As root, create a file inside. Let's call it

dotnet_optout.sh

Open it with a text editor and enter the following:

#!/bin/sh

DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_CLI_TELEMETRY_OPTOUT

Make the file executable by all:

chmod a+x /etc/profile.d/dotnet_optout.sh

Afterwards, you can log out and back in or:

source ~/.bash_profilebash

And that will start a new shell session which sources /etc/profile.d/dotnet_optout.sh

To confirm when you're done, enter:

echo $DOTNET_CLI_TELEMETRY_OPTOUT

You'll get an output of 1.

In short, any script that is executable by everyone who is using bash (or some sh-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.

If you are using Ubuntu as one of your tags says, you'll have a directory called

/etc/profile.d

As root, create a file inside. Let's call it

dotnet_optout.sh

Open it with a text editor and enter the following:

#!/bin/sh

DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_CLI_TELEMETRY_OPTOUT

Make the file executable by all:

chmod a+x /etc/profile.d/dotnet_optout.sh

Afterwards, you can log out and back in or:

source ~/.bash_profile

To confirm when you're done, enter:

echo $DOTNET_CLI_TELEMETRY_OPTOUT

You'll get an output of 1.

In short, any script that is executable by everyone who is using bash (or some sh-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.

If you are using Ubuntu as one of your tags says, you'll have a directory called

/etc/profile.d

As root, create a file inside. Let's call it

dotnet_optout.sh

Open it with a text editor and enter the following:

#!/bin/sh

DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_CLI_TELEMETRY_OPTOUT

Make the file executable by all:

chmod a+x /etc/profile.d/dotnet_optout.sh

Afterwards, you can log out and back in or:

bash

And that will start a new shell session which sources /etc/profile.d/dotnet_optout.sh

To confirm when you're done, enter:

echo $DOTNET_CLI_TELEMETRY_OPTOUT

You'll get an output of 1.

In short, any script that is executable by everyone who is using bash (or some sh-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.

Clarify that the solution works only for sh-like shells
Source Link
Andy Dalton
  • 14.7k
  • 1
  • 29
  • 50

If you are using Ubuntu as one of your tags says, you'll have a directory called

/etc/profile.d

As root, create a file inside. Let's call it

dotnet_optout.sh

Open it with a text editor and enter the following:

#!/bin/bashsh

DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1DOTNET_CLI_TELEMETRY_OPTOUT

Make the file executable by all:

chmod a+x /etc/profile.d/dotnet_optout.sh

Afterwards, you can log out and back in or:

source ~/.bash_profile

To confirm when you're done, enter:

echo $DOTNET_CLI_TELEMETRY_OPTOUT

You'll get an output of 1.

In short, any script whichthat is executable by everyone who is using bash (or some sh-like shell that sources /etc/profile) that you put inside of that directory will affect everyone's environment if they are using bash.

If people are using another shell such as ksh or tsch, you can set the variable in:

/etc/profile

Add a line:

 DOTNET_CLI_TELEMETRY_OPTOUT=1

That file is sourced by allhave users who use other shells. If you're sure that everyone is using bash, you can use the first method of putting the script in /etc/profile.d.

/etc/profile is easier than creating a script for every single shellconfiguration will be similar, but you'll need to update different configuration files.

If you are using Ubuntu as one of your tags says, you'll have a directory called

/etc/profile.d

As root, create a file inside. Let's call it

dotnet_optout.sh

Open it with a text editor and enter the following:

#!/bin/bash

export DOTNET_CLI_TELEMETRY_OPTOUT=1

Make the file executable by all:

chmod a+x /etc/profile.d/dotnet_optout.sh

Afterwards, you can log out and back in or:

source ~/.bash_profile

To confirm when you're done, enter:

echo $DOTNET_CLI_TELEMETRY_OPTOUT

You'll get an output of 1.

In short, any script which is executable by everyone who is using bash that you put inside of that directory will affect everyone's environment if they are using bash.

If people are using another shell such as ksh or tsch, you can set the variable in:

/etc/profile

Add a line:

 DOTNET_CLI_TELEMETRY_OPTOUT=1

That file is sourced by all shells. If you're sure that everyone is using bash, you can use the first method of putting the script in /etc/profile.d.

/etc/profile is easier than creating a script for every single shell.

If you are using Ubuntu as one of your tags says, you'll have a directory called

/etc/profile.d

As root, create a file inside. Let's call it

dotnet_optout.sh

Open it with a text editor and enter the following:

#!/bin/sh

DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_CLI_TELEMETRY_OPTOUT

Make the file executable by all:

chmod a+x /etc/profile.d/dotnet_optout.sh

Afterwards, you can log out and back in or:

source ~/.bash_profile

To confirm when you're done, enter:

echo $DOTNET_CLI_TELEMETRY_OPTOUT

You'll get an output of 1.

In short, any script that is executable by everyone who is using bash (or some sh-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.

added 58 characters in body
Source Link
Nasir Riley
  • 12.4k
  • 2
  • 26
  • 30
Loading
added 236 characters in body
Source Link
Nasir Riley
  • 12.4k
  • 2
  • 26
  • 30
Loading
Source Link
Nasir Riley
  • 12.4k
  • 2
  • 26
  • 30
Loading