Is there a way to switch Android users from the command line? Using the following command, I managed to enable multi-user mode in an Android device that doesn't officicially support it: adb shell setprop fw.max_users 4. For good measure I also added the following entry to the build.prop file:

fw.max_users=5


There's now a Settings menu for creating additional users in my device. Upon creating a new user, I would be switched to the multi-user lock screen with icons at the bottom showing the user accounts available in the device. From there I can choose my user log-in.

Moreover, the account data of the new user survives a reboot. From this, I can conclude that multi-user mode is working. 

The problem is my Android device, a media player running some version of Jellybean 4.2, normally doesn't display the lock screen. No lock screen appears when I start up the device nor after I suspend or put the device to sleep.

In fact, the only time I see the lock screen is immediately after creating a new user. Once I've logged in as the new user, I can't switch back to the lock screen because the device is configured to show only the bottom panel and therefore I have no way to click the User icon in the Quick Settings menu of the missing top panel.

It seems a bit overkill to do some low-level system hacks just to achieve the desktop Linux equivalent of Control-Alt-F8, etc. Is there a command, perhaps using some intent or activity available via the Android activity manager tool (am) that would allow me to switch between different user log-ins or at least to switch to the lock screen that would allow me to log in as a different user?
Yes there is.
When the community discovered this feature in android 4.1 (the code was exist but has not been declared yet so Google did not open the feature in Settings), I remember playing with this in my Nexus 4.

So, here are some commands that I remember for the android Terminal:


Create new user: pm create-user User_Name
To switch between users: am switch-user User_ID
To get the list of all the users: pm list users
To delete a user: pm remove-user User_ID


Hope this helps.