1. Secret Logo

Fill passwords in your terminal

Secrets for Mac can fill passwords in your terminal in two ways. Use SSH askpass for OpenSSH logins in any terminal app, or use the iTerm2 integration for any password prompt in iTerm2.

SSH askpass

OpenSSH can use Secrets to pick a saved password when you connect to a server that asks for one. Add these two lines to your shell startup file (for example, ~/.zshrc if you use zsh). If you installed Secrets somewhere other than Applications, adjust the path.

export SSH_ASKPASS="/Applications/Secrets.app/Contents/MacOS/askpass"
export SSH_ASKPASS_REQUIRE=force

Open a new terminal session to load these settings, then connect as usual. Replace user@host with your SSH username and hostname.

ssh user@host

When SSH asks for a login password, Secrets opens its password picker. If Secrets recognizes the prompt, it shows the SSH destination and searches for the hostname. You can change the search if needed. Choose a saved login and click Fill to send its password to SSH.

The Secrets helper handles SSH login passwords only. To verify a new host key or enter a private key passphrase or one-time code, use the terminal prompts for that connection:

SSH_ASKPASS_REQUIRE=never ssh user@host

iTerm2 integration

iTerm2 is a popular terminal app for the Mac. Its integration with Secrets works with any password prompt in iTerm2, including prompts from commands such as sudo as well as SSH. Use the Secrets shortcut when the prompt is waiting for input.

Set up password filling

  1. In iTerm2, open Settings → General → Magic and enable the Python API.
  2. Open Secrets → Preferences → Integrations, click Enable under iTerm2, then click Continue.
  3. Select the folder shown. Secrets creates any missing folders in the Scripts/AutoLaunch path and links its bundled script there.
  4. Quit and reopen iTerm2 to launch the script. Approve iTerm2’s Python API authorization prompt if it appears.

If you move Secrets to another folder, open Integrations and repeat setup to repair the link.

Fill a password

  1. Focus the iTerm2 pane waiting for a password and press your Secrets keyboard shortcut.
  2. Unlock Secrets if prompted, then search for the login and choose the password to fill.

Secrets fills and submits the password automatically.

Secrets fills the pane that was selected when you pressed the shortcut, even if you switch panes while the picker is open. If that pane closes, open the picker again from the pane you want to use. iTerm2’s broadcast setting does not affect the fill.

You can also open the Secrets menu-bar menu and select a pane from the Fill entries. Secrets looks for password prompts in open iTerm2 panes when you open the menu. The shortcut is available for prompts Secrets does not recognize.

Didn't find what you were looking for? Contact Us