Linux, like all operating systems, saves the initial / standard settings and configuration parameters for its programs in the form of configuration files. These files are used to configure software applications, server processes, and OS settings for your system. As Linux administrators, you can edit these files in various ways; one of them comments or uncomments the configuration line.
When you open the configuration file, you can see one or more lines starting with the symbol ‘#“; this means that this line has been commented out. When the interpreter reads the contents of the configuration file, it ignores lines starting with #. Therefore, any commented line that includes functions means that the corresponding function is disabled on your system.
Here’s what the included (uncommented) function looks like in the configuration file:
# This is an enabled feature FeatureEnable= true
Here’s what a disabled (commented out) function looks like in a configuration file:
# This is a disabled feature #FeatureEnable = true
In this article, we will present an example and see how commenting and uncommenting lines or more can be used to enable or disable a function on your Linux system. We will run this example on Ubuntu 18 to enable automatic login for the user through the custom.conf file located in / etc / gdm3 /
Example: Enabling Automatic Login for an Ubuntu User
Let’s take advantage of this annotation and uncomment feature to enable automatic user login in Ubuntu.
- Open Terminal via Ubuntu Dash or Ctrl + Alt + T,
- Open custom.conf file in the Nano editor using the following command:
$ sudo nano /etc/gdm3/custom.conf
Please note that you must be superuser to edit most system configurations.
When you enter your password, the following file will open:
You can see that the selected lines have been commented out. This means that the automatic login feature for user1 is disabled.
You can simply remove the # character from the last two lines we selected and specify the username instead of the “user1” value for the user whose automatic login you want to enable. For instance:
You can see the color change of the included function.
Now save the file by clicking Ctrl + X and then Y,
Now, when you restart your computer, you will log in without asking for authentication information.
We have seen how uncommenting a function string can enable this. You can disable the function in the same way by adding the # character at the beginning of the line that defines the function.
Commenting out / uncommenting a line in an Ubuntu configuration file