如何自动化 Lastpass CLI 登录过程

Rub*_*ers 4 authentication automation command-line-interface passwordvault lastpass

我想知道是否有人成功自动化 LastPass CLI 登录过程。我似乎无法绕过密码提示,我需要自动化它才能使其有用。

我尝试过类似的命令

echo <password> | lpass login <username>
Run Code Online (Sandbox Code Playgroud)

或者

yes <password> | lpass login <username>
Run Code Online (Sandbox Code Playgroud)

我不断收到输出说密码不正确。有人自动化这个吗?

谢谢!

小智 7

您可能需要禁用 pinetry 密码提示,以便 lpass 从标准输入读取您的密码。

正如手册页所说:

如果 pinentry 程序不可用,或者 LPASS_DISABLE_PINENTRY 环境变量设置为 1,将从标准输入读取密码,并在标准错误上显示提示。

含义:如果你像这样运行它应该可以工作:

echo <password> | LPASS_DISABLE_PINENTRY=1 lpass login <username>
Run Code Online (Sandbox Code Playgroud)

或者只需为您的 shell 设置环境变量(export LPASS_DISABLE_PINENTRY=1在您的~/.profile或类似的中)