TOTP (Time-based One-Time Password) is a widely used 2FA method that generates a time-sensitive code for added security. This guide will walk you through the process of installing, configuring, and utilizing the powerful totp-cli tool on your Ubuntu system to manage your TOTP tokens with ease.
Update Your System: Begin by ensuring that your system is up to date. Open a terminal window and run the following command:sudo apt update
Install Go: Now, install Go by executing the following command:sudo apt install golang-go
This will download and install Go on your Ubuntu system.
Download and Install totp-cli: Use the following command to install totp-cli:go install github.com/agrinman/totp-cli@latest
Setting the Go Path (Optional): In some cases, Go may not be automatically added to your system's path. If you encounter issues running totp-cli, you need to add it manually. Open your '.bashrc' file (located in your home directory) and add the following line:export PATH=$PATH:$HOME/go/bin
Reload Your Terminal: To apply the changes you made to your '.bashrc' file, execute the following command:source ~/.bashrc
Adding a New TOTP Secret: To add a new TOTP secret, use the following command:totp-cli add "My Account" YOUR_SECRET
Replace "My Account" with a descriptive name for your account (e.g., "Gmail," "Facebook," "Dropbox"). Replace YOUR_SECRET with the actual TOTP secret code that you received from the service.
Listing Your TOTP Accounts: To see all the TOTP accounts you have added, use the following command:totp-cli list
This will display a list of your accounts and their corresponding secrets. Generating a TOTP Code: To generate a time-based code for a specific account, use this command:totp-cli generate "My Account"
This will display the current TOTP code for your "My Account" entry. Remember that these codes expire quickly, so use them immediately.
Creating a Backup: Use the following command to back up all your TOTP secrets to a JSON file named 'backup.json':totp-cli dump > backup.json
Store the 'backup.json' file in a safe and secure location, ideally on an external drive or cloud storage.
Importing the Backup: Use the following command to import your backup file:totp-cli import < backup.json
This will load all the TOTP secrets from your 'backup.json' file, restoring access to your accounts.
0 comments:
Post a Comment