In this tutorial we'll cover how to setup and configure the "pk" command line tool, for both interactive and non interactive use. With the pk cli you can:
  • Run commands and programs (even a bash shell) with pre-configured environments.
  • Combine several environments to pull in the environment variables you want.
  • Get secrets, notes and software keys.
  • Connect to databases from a universal sql command line (or use your favourite db tool).

The pk cli can be configured in three ways:
  1. 1. Using a config file
  2. 2. Via environment variables
  3. 3. Interactively typing your username and password


We assume you already have an account setup with PKHub.

The rest of the tutorial assumes you have acccess to a command line terminal, and all commands when run will be executed in the command line terminal.


To install run the following command:
curl https://docs.pkhub.io/install/install.sh | sh


Interactive user name and password

Using the "-p" flag in the "pk" command, will ask you for your user name and password
This is an easy way to login and use the pk command, and also the most secure, because you do not have to have any keys on your computer.

pk sh -p -s [your-safe] -n [any-env] -i -- bash

Having to type in your user name and password everytime you run the pk command is not very convenient, and for automated non interactive scripts will not work.

It's also not very secure to have your user name and password on text files on each computer you run "pk" on. A good alternative is using application keys. These are keys you can create and revoke; either directly or via an expire date. The keys can be provided as environment variables or as a configuration file.

Configuration via Environment Variables