Command line (CLI)
For the rare case that nobody can log in any more – a forgotten password, a locked admin – the CocktailPi program has a small command line tool for user administration. It works directly on the database and doesn't need the web UI.
Starting it
Connect to the Pi via SSH, become root and change into the CocktailPi folder. The folder matters: the tool uses the database in the current directory.
sudo -i
cd /root/cocktailpi
java -jar cocktailpi.jar user <command>There is no wrapper script; it's the same cocktailpi.jar that the service runs. The service doesn't have to be stopped: the tool can run while CocktailPi is running, and a changed password works right away.
It exits with code 0 on success and 1 on an unknown user or invalid arguments, so it can be used in scripts.
Commands
user list
Lists all users with their role, whether they are locked and whether they are an autologin user (local, remote).
java -jar cocktailpi.jar user listUSERNAME ROLE LOCKED AUTOLOGIN LOCAL AUTOLOGIN REMOTE
Admin SUPER_ADMIN no no no
Kiosk USER no yes nouser reset-password <username>
Sets a new password. The tool asks for it twice; the input is hidden.
java -jar cocktailpi.jar user reset-password AdminFor scripts, or where no interactive console is available, the password can be passed directly. Note that it then ends up in the shell history:
java -jar cocktailpi.jar user reset-password Admin --password 'my new password'Passwords must be 6 to 40 characters long. Usernames are not case-sensitive.
user unlock <username>
Unlocks a user that was locked in the user management (Locked).
java -jar cocktailpi.jar user unlock AdminWhat it can't do
The tool only has these three commands. It can't create users or change roles – reset the password of an existing Super-Admin instead (user list shows which users have that role) and do everything else in the web UI.