Results 1 to 7 of 7

Thread: How do I retrieve a stored password from the gnome keyring?

  1. #1
    Join Date
    Oct 2008
    Beans
    3,509

    How do I retrieve a stored password from the gnome keyring?

    I've been binding an xdotool command to a mouse button to type my password
    but thought I might try making it more secure by storing the password in the keyring
    and retrieving it to be used in the xdotool command.

    ie
    the xdotool command types my password and hits enter.
    Code:
    xdotool key --delay 50 P A S S W O R D Return
    I want it to be like this...
    Code:
    xdotool key --delay 50 `command to retrieve password from keyring` Return
    ...but don't know how to retrieve a stored password from the keyring.
    Last edited by stinkeye; March 15th, 2013 at 09:43 PM.

  2. #2
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: How do I retrieve a stored password from the gnome keyring?

    Not sure I understand what keyring you mean, but there are python modules to access system keyrings like Gnome-keyring and KWallet from python scripts: python-keyring, python-gnomekeyring, python3-keyring. Besides, there's nss-passwords to read passwords from Mozilla products.

  3. #3
    Join Date
    Oct 2008
    Beans
    3,509

    Re: How do I retrieve a stored password from the gnome keyring?

    I don't understand much about passwords and keyrings.
    It's a password I added under the login section in seahorse.
    I don't understand python or any code, except simple bash.

    Just wondered if there was a simple command line way to access the
    password I added or does it need to be done in a python script?
    Attached Images Attached Images
    Last edited by stinkeye; March 15th, 2013 at 07:06 PM.

  4. #4
    Join Date
    Oct 2008
    Beans
    3,509

    Re: How do I retrieve a stored password from the gnome keyring?

    ok, thanks.
    I found this python script described as...
    A small Python tool for shell access to GNOME keyring. It provides a simple way to query and create keyring items.
    Seems to do as I want.
    I can use it to add a password to gnome keyring and also retrieve.
    When I add with something like this, it then asks to put in the password to be saved.
    I put the password in and then it outputs an ID.
    Code:
    glen@Quantal:~$ gkeyring --set -n mylogin -p mylogin=1
    Password: 
    12
    Then to retrieve...
    Code:
    gkeyring --id 12 --output secret --no-newline
    I googled for a sed script to put spaces between the characters of a string
    so when used with xdotool it would recognize the output as individual characters.
    eg
    Code:
    xdotool key --delay 50 `gkeyring --id 12 --output secret --no-newline | sed 's/./& /g'` Return
    Now,using easystroke, I have a spare mouse button to autoType my password whenever authentication is required...including the lockscreen.
    Not really needed...I just wanted to see if it could be done.
    Attached Images Attached Images
    Last edited by stinkeye; May 15th, 2013 at 04:09 PM.

  5. #5
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: How do I retrieve a stored password from the gnome keyring?

    Quote Originally Posted by stinkeye View Post
    ok, thanks.
    I found this python script described as...


    Seems to do as I want.
    I can use it to add a password to gnome keyring and also retrieve.
    When I add with something like this, it then asks to put in the password to be saved.
    I put the password in and then it outputs an ID.
    Code:
    glen@Quantal:~$ gkeyring --set -n mylogin -p mylogin=1
    Password: 
    12
    Then to retrieve...
    Code:
    gkeyring --id 12 --output secret --no-newline
    I googled for a sed script to put spaces between the characters of a string
    so when used with xdotool it would recognize the output as individual characters.
    eg
    Code:
    xdotool key --delay 50 `gkeyring --id 12 --output secret --no-newline | sed 's/./& /g'` Return
    Now,using easystroke, I have a spare mouse button to autologin whenever authentication is required.
    Not really needed...I just wanted to see if it could be done.
    Interesting

    I tried gkeyring and it works for me too. I made the following mini-script to view all my 'secrets' alias passwords in this keyring.
    Code:
    i=0;while true; do i=$(($i+1));python gkeyring.py --id "$i" -o id,secret,name||break;done
    It works when logged into the desktop with 'my own user id'. I tested the security: if it would work from another user, but I did not manage to do that. Then I found that it does not work with my own user, when logged in via ssh from another computer in the LAN. I have looked into the python script, but have to admit, that I don't understand it.

    How come it won't work via ssh? I also found that Seahorse finds the gpg keys, but not these 'secrets' alias passwords via ssh (while it finds everything when logged into the desktop). Is it designed to be like that or a bug?

  6. #6
    Join Date
    Oct 2008
    Beans
    3,509

    Re: How do I retrieve a stored password from the gnome keyring?

    Quote Originally Posted by sudodus View Post
    Interesting

    I tried gkeyring and it works for me too. I made the following mini-script to view all my 'secrets' alias passwords in this keyring.
    Code:
    i=0;while true; do i=$(($i+1));python gkeyring.py --id "$i" -o id,secret,name||break;done
    It works when logged into the desktop with 'my own user id'. I tested the security: if it would work from another user, but I did not manage to do that. Then I found that it does not work with my own user, when logged in via ssh from another computer in the LAN. I have looked into the python script, but have to admit, that I don't understand it.

    How come it won't work via ssh? I also found that Seahorse finds the gpg keys, but not these 'secrets' alias passwords via ssh (while it finds everything when logged into the desktop). Is it designed to be like that or a bug?
    Have a look here ...
    access keyring over ssh

  7. #7
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: How do I retrieve a stored password from the gnome keyring?

    Quote Originally Posted by stinkeye View Post
    Have a look here ...
    access keyring over ssh
    Yes, this works, and I'm beginning to understand

    Thank you

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •