Non-root user cannot access keyring unless in X Windows
Created originally on Bitbucket by lessonz (Ricardo Torres)
I must first start by admitting I am neither a python nor linux guru. It's entirely possible the problem is with me and not the software. If so, I apologize in advance. Everything works fine for the root user. Everything also works fine for the less privileged user when a terminal is launched in X Windows. Below are what I believe to be the relevant bits:
{{{ $ easy_install --upgrade keyring install_dir /usr/lib/python2.7/site-packages/ Searching for keyring Reading http://pypi.python.org/simple/keyring/ Reading http://home.python-keyring.org/ Reading http://keyring-python.org/ Best match: keyring 0.5.1 Processing keyring-0.5.1-py2.7.egg keyring 0.5.1 is already the active version in easy-install.pth
Using /usr/lib/python2.7/site-packages/keyring-0.5.1-py2.7.egg Processing dependencies for keyring Finished processing dependencies for keyring }}} {{{ $ easy_install --upgrade mercurial_keyring install_dir /usr/lib/python2.7/site-packages/ Searching for mercurial-keyring Reading http://pypi.python.org/simple/mercurial_keyring/ Reading http://mekk.waw.pl Reading http://bitbucket.org/Mekk/mercurial_keyring Best match: mercurial-keyring 0.4.5 Processing mercurial_keyring-0.4.5-py2.7.egg mercurial-keyring 0.4.5 is already the active version in easy-install.pth
Using /usr/lib/python2.7/site-packages/mercurial_keyring-0.4.5-py2.7.egg Processing dependencies for mercurial-keyring Finished processing dependencies for mercurial-keyring }}} {{{ $ hg clone https://XXXX@bitbucket.org/XXXX/YYYY ** unknown exception encountered, please report by visiting ** http://mercurial.selenic.com/wiki/BugTracker ** Python 2.7.1 (r271:86832, Apr 12 2011, 16:15:16) [GCC 4.6.0 20110331 (Red Hat 4.6.0-2)] ** Mercurial Distributed SCM (version 1.9) ** Extensions loaded: mercurial_keyring Traceback (most recent call last): File "/usr/bin/hg", line 38, in mercurial.dispatch.run() File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 27, in run sys.exit(dispatch(request(sys.argv[1:]))) File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 64, in dispatch return _runcatch(req) File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 87, in _runcatch return _dispatch(req) File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 675, in _dispatch cmdpats, cmdoptions) File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 454, in runcommand ret = _runcommand(ui, options, cmd, d) File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 729, in _runcommand return checkargs() File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 683, in checkargs return cmdfunc() File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 672, in d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) File "/usr/lib64/python2.7/site-packages/mercurial/util.py", line 385, in check return func(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/mercurial/commands.py", line 1041, in clone branch=opts.get('branch')) File "/usr/lib64/python2.7/site-packages/mercurial/hg.py", line 217, in clone srcrepo = repository(remoteui(ui, peeropts), source) File "/usr/lib64/python2.7/site-packages/mercurial/hg.py", line 93, in repository repo = _peerlookup(path).instance(ui, path, create) File "/usr/lib64/python2.7/site-packages/mercurial/httprepo.py", line 230, in instance inst._fetchcaps() File "/usr/lib64/python2.7/site-packages/mercurial/httprepo.py", line 56, in _fetchcaps self.caps = set(self._call('capabilities').split()) File "/usr/lib64/python2.7/site-packages/mercurial/httprepo.py", line 163, in _call fp = self._callstream(cmd, **args) File "/usr/lib64/python2.7/site-packages/mercurial/httprepo.py", line 113, in _callstream resp = self.urlopener.open(req) File "/usr/lib64/python2.7/urllib2.py", line 398, in open response = meth(req, response) File "/usr/lib64/python2.7/urllib2.py", line 511, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib64/python2.7/urllib2.py", line 430, in error result = self._call_chain(*args) File "/usr/lib64/python2.7/urllib2.py", line 370, in _call_chain result = func(*args) File "/usr/lib64/python2.7/urllib2.py", line 1059, in http_error_401 host, req, headers) File "/usr/lib64/python2.7/site-packages/mercurial/url.py", line 395, in http_error_auth_reqed self, auth_header, host, req, headers) File "/usr/lib64/python2.7/urllib2.py", line 944, in http_error_auth_reqed return self.retry_http_digest_auth(req, authreq) File "/usr/lib64/python2.7/urllib2.py", line 949, in retry_http_digest_auth auth = self.get_authorization(req, chal) File "/usr/lib64/python2.7/urllib2.py", line 984, in get_authorization user, pw = self.passwd.find_user_password(realm, req.get_full_url()) File "/usr/lib/python2.7/site-packages/mercurial_keyring-0.4.5-py2.7.egg/mercurial_keyring.py", line 298, in find_user_password return self._pwd_handler.find_auth(self, realm, authuri) File "/usr/lib/python2.7/site-packages/mercurial_keyring-0.4.5-py2.7.egg/mercurial_keyring.py", line 158, in find_auth pwd = password_store.get_http_password(keyring_url, user) File "/usr/lib/python2.7/site-packages/mercurial_keyring-0.4.5-py2.7.egg/mercurial_keyring.py", line 55, in get_http_password self._format_http_key(url, username)) File "/usr/lib/python2.7/site-packages/keyring-0.5.1-py2.7.egg/keyring/core.py", line 30, in get_password return _keyring_backend.get_password(service_name, username) File "/usr/lib/python2.7/site-packages/keyring-0.5.1-py2.7.egg/keyring/backend.py", line 139, in get_password items = gnomekeyring.find_network_password_sync(username, service) gnomekeyring.IOError }}}