Skip to content

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.

bash
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).

bash
java -jar cocktailpi.jar user list
USERNAME              ROLE                    LOCKED  AUTOLOGIN LOCAL  AUTOLOGIN REMOTE
Admin                 SUPER_ADMIN             no      no               no
Kiosk                 USER                    no      yes              no

user reset-password <username> ​

Sets a new password. The tool asks for it twice; the input is hidden.

bash
java -jar cocktailpi.jar user reset-password Admin

For scripts, or where no interactive console is available, the password can be passed directly. Note that it then ends up in the shell history:

bash
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).

bash
java -jar cocktailpi.jar user unlock Admin

What 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.

Try the online demo

Log in with the credentials below. The demo is shared with other visitors and is reset from time to time, so your changes may be lost.

User
Admin
Password
123456