13

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
  • 10,082
  • 5
  • 45
  • 73

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: 
Sybil
  • 2,503
  • 3
  • 25
  • 36
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,872
  • 1
  • 41
  • 59
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,499
  • 1
  • 22
  • 33