11

I have forgotten my luci password, but can get in via ssh. How do I reset the luci password from the console? I see that in /etc/config/luci there is this:

config extern 'flash_keep'
...
        option passwd '/etc/passwd'
...

So is it done with the regular passwd command?

rainkinz
  • 9,042
  • 5
  • 34
  • 65

3 Answers3

5

You can change root password use passwd command via ssh. Normally,the root password is luci password.

\# passwd

Changing password for root

New password: 
Ivanov
  • 2,271
  • 2
  • 19
  • 34
able
  • 66
  • 1
2

You actually have to issue mount_root before using passwd, then reboot. The method in this answer alone didn't work for me (18.06.1)

root@(none):~# mount_root
switching to jffs2 overlay
root@(none):/rom/root# passwd
Changing password for root
New password:
Retype password:
passwd: password for root changed by root
root@(none):/rom/root# reboot -f

via https://openwrt.org/docs/guide-user/troubleshooting/root_password_reset

Gaia
  • 2,355
  • 1
  • 35
  • 55
1

If you'd like to use a non-root user for luci, I did this on a project a few months ago:

https://github.com/sudomesh/luci-app-peopleswifi/blob/master/luasrc/controller/peopleswifi/index.lua

where "admin" was another user in openwrt. It should be said that my understanding is that openwrt is specifically not secure in multi-user environments. While theoretically you can not give that "admin" user a login shell, I'm not sure that I would depend on this solution as a secure alternative to using luci authentication as root.

urban_raccoons
  • 3,429
  • 1
  • 18
  • 31