Enabling USB debugging from open file system access using custom recovery Of course this should be possible, but finding the correct files to modify is the real question. 

Assuming we can boot into a custom recovery and have full access to the file system, has anyone investigated the steps for enabling USB debugging? 

The motivation for this request is that I have a device that will not fully boot, so a log dump would be very helpful in this case.
The correct file to modify is the build prop. Which can be risky to modify. This will enable everything needed. Through the file system modify the build.prop or with a computer. If the custom recovery is TWRP or possibly CWM. Then adb comes pre-enabled. Then you also need root and a computer with adb.


boot into your custom recovery.
Plug your device into your computer and open an elevated command prompt.
Throw these commands.



  adb shell
  
  su
  
  mount -o remount,rw /system
  
  cd /
  
  echo "persist.service.adb.enable=1" >> default.prop
  
  echo "persist.service.debuggable=1" >> default.prop
  
  echo "persist.sys.usb.config=mtp,adb" >> default.prop
  
  echo "persist.service.adb.enable=1" >> /system/build.prop
  
  echo "persist.service.debuggable=1" >> /system/build.prop
  
  echo "persist.sys.usb.config=mtp,adb" >> /system/build.prop


I have done it this way with a nexus 4 and since this is the build prop. Here are some others that have too.