Hi,
I've searched the forums, but can't find an up-to-date answer to the question.
I have lost my password for the deluge webui, and was wondering how I go about resetting it. I have tried removing the web.conf file, with no luck, and I can't find where it is stored so that I can reset it.
Any help is appreciated.
Thanks
Reset deluge webui password.
Re: Reset deluge webui password.
You can use the following python script:
See below for newest version: http://forum.deluge-torrent.org/viewtop ... 47#p150899
Make sure you change DELUGE_DIR to point to your deluge's setting directory and that deluge-web isn't running when you run this script.
See below for newest version: http://forum.deluge-torrent.org/viewtop ... 47#p150899
Code: Select all
#!/usr/bin/env python
# Changes the password for Deluge's Web UI
from deluge.common import json
import hashlib
import os.path
DELUGE_DIR = "/etc/deluge"
try:
config_file = open(os.path.join(os.path.expanduser(DELUGE_DIR), "web.conf"))
config = json.load(config_file)
config_file.close()
except IOError, e:
print "Can't open web ui config file: ", e
else:
password = raw_input("Enter new password: ")
s = hashlib.sha1()
s.update(config['pwd_salt'])
s.update(password)
config['pwd_sha1'] = s.hexdigest()
try:
config_file = open(os.path.join(os.path.expanduser(DELUGE_DIR), "web.conf"), "w")
json.dump(config, config_file)
except IOError, e:
print "Couldn't save new password: ", e
else:
print "New password successfully set!"
Re: Reset deluge webui password.
When I try to run the script, I get this error:
I've double checked my config directory path is correct (~/.config/deluge), but I don't know any python so I'm not sure what it's erroring on to go any further.
Thanks for your help.
Code: Select all
Traceback (most recent call last):
File "./delugeReset.py", line 12, in <module>
config = json.load(config_file)
File "/var/lib/python-support/python2.5/simplejson/__init__.py", line 273, in load
parse_constant=parse_constant, **kw)
File "/var/lib/python-support/python2.5/simplejson/__init__.py", line 313, in loads
return _default_decoder.decode(s)
File "/var/lib/python-support/python2.5/simplejson/decoder.py", line 324, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 4 column 2 - line 20 column 2 (char 31 - 489)
Thanks for your help.
Re: Reset deluge webui password.
If it helps, this is what my web.conf file looks like. It seems to error when it tries to read the second part of the file.
Code: Select all
{
"file": 1,
"format": 1
}{
"sidebar_show_zero": false,
"pkey": "ssl/daemon.pkey",
"https": false,
"sessions": {},
"pwd_salt": "a8fce7b60bc6b1fdd6fdc39d472cee89afa579e5",
"port": 53009,
"show_session_speed": false,
"cert": "ssl/daemon.cert",
"enabled_plugins": [],
"pwd_sha1": "88eeeb13cd717c760489d901edde8a1bc65e5bf7",
"sidebar_show_trackers": false,
"theme": "slate",
"session_timeout": 3600,
"show_sidebar": true,
"default_daemon": ""
}
Re: Reset deluge webui password.
Has anyone gotten the script that johnnyg posted to work? I'm getting the same errors as obses.
This script would be very useful to me.
I would be very grateful if someone shed some light on this.
Thanks
EDIT:
Made it work by removing the following from the top:
Code: Select all
./dwebuipass.py
Traceback (most recent call last):
File "./dwebuipass.py", line 12, in <module>
config = json.load(config_file)
File "/usr/lib/python2.6/json/__init__.py", line 267, in load
parse_constant=parse_constant, **kw)
File "/usr/lib/python2.6/json/__init__.py", line 307, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.6/json/decoder.py", line 322, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 4 column 2 - line 29 column 1 (char 31 - 672)
I would be very grateful if someone shed some light on this.
Thanks
EDIT:
Made it work by removing the following from the top:
Code: Select all
{
"file": 1,
"format": 1
}
Re: Reset deluge webui password.
I remember reading that error and then rewriting the script to work with any config file but I obviously forgot to post it
Anyway, here it is for anyone else who needs it.
Anyway, here it is for anyone else who needs it.
Code: Select all
#!/usr/bin/env python
# Changes the password for Deluge's Web UI
from deluge.config import Config
import hashlib
import os.path
import sys
if len(sys.argv) == 2:
deluge_dir = os.path.expanduser(sys.argv[1])
if os.path.isdir(deluge_dir):
try:
config = Config("web.conf", config_dir=deluge_dir)
except IOError, e:
print "Can't open web ui config file: ", e
else:
password = raw_input("Enter new password: ")
s = hashlib.sha1()
s.update(config['pwd_salt'])
s.update(password)
config['pwd_sha1'] = s.hexdigest()
try:
config.save()
except IOError, e:
print "Couldn't save new password: ", e
else:
print "New password successfully set!"
else:
print "%s is not a directory!" % deluge_dir
else:
print "Usage: %s <deluge config dir>" % (os.path.basename(sys.argv[0]))
-
- Member
- Posts: 11
- Joined: Wed Sep 15, 2010 10:34 pm
Re: Reset deluge webui password.
Thanks that python script is useful.