enable-autoexec option not working in ubuntu blender main.py:

import bpy
bpy.ops.wm.addon_enable(module="io_import_scene_mhx")
bpy.ops.import_scene.makehuman_mhx(filepath="~/Desktop/first_gen.mhx")


blender --background --enable-autoexec --python main.py

GIVES THE ERROR:
Error when loading MHX file ~/Desktop/first_gen.mhx:
Auto Run Python Scripts must be turned on.
It is found under
 File > User Preferences > File
Error: Not freed memory blocks: 4, total unfreed memory 0.000687 MB

I've installed it on aws where I do not have access to the GUI to go tick the Auto Execution in File > User Preference > File . How do I do it from the command line ? --enable_autoexec does not seem to work. 
Are there other ways of setting UserPreferencesSystem.use_scripts_auto_execute to True ?
As explained here, the --python cli option will bypass the settings, allowing a script to alter the setting. You can set it in python with

bpy.context.user_preferences.system.use_scripts_auto_execute = True


Another way of setting preferences is the userpref.blend file. You can save one on your machine then copy it to your remote server. There are several places blender looks for the userpref.blend - LOCAL, USER, SYSTEM - in that order. If you manually install a pre-built copy then you can add your userpref.blend into the local folder which would be 2.76/config/userpref.blend next to blender itself. More likely you will want to add it to your home folder ~/.config/blender/2.76/config/userpref.blend If that fails you can also set environment variables with the paths to look for certain files.