Login with bash script into laspass-cli

Have questions about LastPass, or having problems using it? Ask for help here!

Moderators: admin, anatoly_LP, chantieLP, Israel, JoeSiegrist, robyn

Login with bash script into laspass-cli

Postby houghi » Sun Dec 16, 2018 10:33 am

Is there a way to use a bashscript (or other method via Linux CLI) to login with lpass without the need to manually enter the password?

That way I can easily use it with bash scripts without the need to have the passwords locally.

Yes, I am well aware of the risks.
houghi
 
Posts: 2
Joined: Sun Dec 16, 2018 10:21 am

Re: Login with bash script into laspass-cli

Postby RevHokan » Tue Jan 08, 2019 1:13 pm

I use a line something like this a provide a password for my email client:

export imap_pass="`/usr/local/bin/lpass show --password $lpass_prefix$imap_user@$from_hostname`"

where $imap_user is my email username (before the "@" and $from_hostname is my email adderess hostname.
I then use $imap_pass as my login password.
RevHokan
 
Posts: 4
Joined: Thu Jan 11, 2018 7:58 pm

Re: Login with bash script into laspass-cli

Postby houghi » Tue Jan 08, 2019 8:43 pm

Thanks for answering.

I think I was not clear. With this method I would still need to enter the master password.

houghi@small : lpass show --password general
Error: Could not find decryption key. Perhaps you need to login with `lpass login`.
houghi@small : lpass login <LOGIN NAME>
Success: Logged in as <LOGIN NAME>
houghi@small : lpass show --password general
password
houghi@small :


So I would still need to give the master password.

I do have found a way. I DO ADVICE AGAINST IT. DO NOT USE THIS!

1) Make a script that will show the password (Told you not to do this)
This can be just an echo or anything else.
2) Set the LPASS_ASKPASS environment variable to the script.
3) "lpass login username" will now work.
4) Do not use this as this is extremely unsafe
houghi
 
Posts: 2
Joined: Sun Dec 16, 2018 10:21 am


Return to General Support & Troubleshooting

Who is online

Users browsing this forum: jhuk and 67 guests