How to enable multiple users in Android virtual devices?

The Android multi-user feature is not yet integrated in Genymotion. If testing an application in a multi-user context or with a restricted profile is required, the feature can be enabled by running the following adb commands:

adb remount

adb shell "echo fw.max_users=4 >> /system/build.prop"

adb shell sync

adb reboot