One-time Password generator for CLI using bash, oathtool
One-Time Password generator for CLI using bash, oathtool.
Automatically copys the token into your computer’s copy buffer (MacOS only atm)
This is basically “Authy for the CLI”
This script supports both encrypted and plain-text token files, but my reccomendation is to use encryption.
Set of bash shell scripts to generate OTP value from token using TOTP.
First ensure that there is a directory “tokenfiles” in the main dir where the script resides, and that this directory’s permissions are set to 700.
$ echo "1234567890abcdef" > tokenfiles/tokenname
$ ./otp-lockfile.sh tokenfiles/tokenname
Password: (enter a good password)
$ ls tokenfiles/
tokenname.enc
$ ./otp.sh tokenname
Password:
02: 123456
The number on the left is the seconds counter; a new TOTP token is generated every 30 seconds.
The number on the right is the 6-digit One-Time Password.
This will be copied directly into the paste buffer. Just press “Command-V” (or “CTRL-V” on Linux) to paste into a login dialog.
In case you want “tokenfiles” to reside in a different location, you can tell otp.sh to use this directory instead by exporting the BASH_OTP_TOKENFILES_DIR
variable like so:
$ export BASH_OTP_TOKENFILES_DIR=/path/to/secure/tokenfiles/dir