How to modify the Tweak Setting from shell?

In order to do that you will need to edit the file below:

/var/cpanel/cpanel.config

After making changes you will need to update with the following :

/usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings

This command will put any changes made to the /var/cpanel/cpanel.config file into effect.
The above settings in /var/cpanel/cpanel.config correspond to the following settings in the WHM in Main >> Server Configuration >> Tweak Settings.

To secure your server via WHM, you can go through our post on How to secure your server via WHM.