Final answer:
System-wide variables in a Linux system should ideally be set in the /etc/environment file, not in /etc/profile. /etc/environment is meant for system-wide operation, while /etc/profile is typically for user configurations.
Step-by-step explanation:
In a Linux operating system, administrators usually set system-wide variables in the /etc/environment file. This file is intended to be system-wide and is executed at system start up. It is a better place for administrator variables compared to /etc/profile, which is mostly used for user configurations and may vary from system to system.
While /etc/profile could still be used, it is recommended to use /etc/environment for better security and maintenance. For instance, to set a system-wide PATH variable, you would add the following line to the /etc/environment:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
This makes sure that all the users have access to the programs in those directories.
Learn more about /etc/environment