It turns out to be rather straightforward to obtain command-line access to an Android phone, also when it is not rooted. Namely, one can use ADB – the Android Debug Bridge, a client-server tool that is part of the Android SDK Platform-Tools package. It requires a working Java runtime environment and is easy to use, following the clear instructions on the ADB homepage.
For example, we can make backups of varying degrees of comprehensiveness, copy files back and forth and, moreover, we have access to the phone’s remote shell. All these operations are scriptable, too. Regarding backups, the process stalls unless I exclude .apk files, .obb files and system apps. This is not really a problem, since a command such as
$ adb backup -f backup.adb -noapk -noobb -shared -all -nosystem
completes successfully and also backs up everything from the phone’s external SD card. In this way, ADB can be very handy for salvaging data from otherwise inaccessible devices.