The correct answer is B: Configure and log in to the Compute Engine instance through SSH, and change the file.
This is the recommended method to make changes to a Linux configuration file on a Compute Engine instance. SSH allows secure remote access to the instance's command line interface, and it is designed to enable you to make changes to the instance's configuration files.
Option A, downloading and uploading the modified version of the file, is not the recommended method as it requires more steps and can introduce errors.
Option C, using the serial port, may be used in some cases, but it is not the recommended method as it requires more steps and can be more complex.
Option D, using a remote desktop client, is not applicable as Linux instances on Compute Engine do not come with a graphical user interface (GUI) by default.