[SOLVED] Hide root user on LUCI login with OpenWrt 23.05.2

Hi all,

as I did up to OpenWrt 22.03.5, just tried what described in the following closed post to hide root user with 23.05.2:

But /usr/lib/lua/luci/dispatcher.lua does not contain local scope = { duser = "root", fuser = user } anymore: am I missing anything?

Thanks in advance.

A lot of Luci has been moved to client side JavaScript rendering and what remains server side is being converted to ucode.

Look in /usr/share/ucode/luci/dispatcher.uc there is a line with:
let scope = { duser: 'root', fuser: user };

1 Like

Thanks a lot, it works.

Do you know how to now change the focus as per Have cursor in username field on LUCI login too?

Looks to be code in /www/luci-static/resources/view/bootstrap/sysauth.js that sets focus to the password field for a default install of 23.05.2. There is only one text input field so changing part of the script from type="password" to type="text" works.

There are other places that seem like they should work but do not - changes to /usr/share/ucode/luci/template/sysauth.ut for example.

1 Like

Thanks, I got stumped on the old type="luci_username" to type="text"

I added to startup to save a step:

#Remove 'root' from username on upgrade
sed --in-place --expression 's/root//' /usr/share/ucode/luci/dispatcher.uc

#Put cursor in username field on upgrade
sed --in-place --expression 's/password/text/' /www/luci-static/resources/view/bootstrap/sysauth.js

Yes, it does what I want, thanks a lot.

If placed in startup (runs on every boot) it might be better to check if a change is needed or not to avoid unnecessary writes. As well match a bit more so other occurrences are left alone.

#Remove default of 'root' from username field on login page
grep -q "duser: 'root'" /usr/share/ucode/luci/dispatcher.uc && sed --in-place --expression "s/duser: 'root'/duser: ''/" /usr/share/ucode/luci/dispatcher.uc

#Put cursor in username field on login page
grep -q '\[type="password"\]' /www/luci-static/resources/view/bootstrap/sysauth.js && sed --in-place --expression 's/\[type="password"\]/\[type="text"\]/' /www/luci-static/resources/view/bootstrap/sysauth.js

Yes indeed, thank you!

Can I ask what the idea behind it is? Convenience ?

changining type="password" to type="text" is not working for me, anyone?