Lock OpenSSH authentication agent.

Display loaded identities.

$ ssh-add -l
2048 SHA256:K9O3a17naC95jx8vCuRzfV9ePVnB/Ya5yEOZpMaCySa /home/milosz/.ssh/gateway (RSA)

Use loaded identity to perform SSH connection.

$ ssh gateway date
Sat Oct 23 13:27:52 BST 2021

Lock SSH agent using a defined password.

$ ssh-add -x
Enter lock password: **********
Again:               **********
Agent locked.

SSH client cannot use locked SSH agent.

$ ssh-add -l
The agent has no identities.
$ ssh-add ~/.ssh/gateway
Enter passphrase for /home/milosz/.ssh/gateway: **********
Could not add identity "/home/milosz/.ssh/gateway": agent refused operation
$ ssh gateway date
Enter passphrase for key '/home/milosz/.ssh/gateway': **********
Sat Oct 23 13:28:26 BST 2021

Unlock SSH agent.

$ ssh-add -X
Enter lock password: **********
Agent unlocked.

Display loaded identities.

$ ssh-add -l
2048 SHA256:K9O3a17naC95jx8vCuRzfV9ePVnB/Ya5yEOZpMaCySa /home/milosz/.ssh/gateway (RSA)

Use loaded identity to perform SSH connection.

$ ssh gateway date
Sat Oct 23 13:29:12 BST 2021