openwrt system default user name is root , and web page login page is also filled with default user name root in the state, taking into account security and its own personality, so the need to develop their favorite username and password yourself.
First, change the password
1, in openwrt development board password
Using the instruction the passwd , directly enter the password to complete the password reset.
2, modify the source code designated to achieve a permanent password
Now development board instruction passwd to modify the password, and / etc / shadow file to copy the contents inside the source file
Inside, and then make V = 99 can be compiled.
Second, openwrt modify the user name development board, the root modified to the name you want (here in a name , for example).
1、/etc/passwd
will
1 root:x:0:0:root:/root:/bin/ash
changed to
1 name:x:0:0:root:/root:/bin/ash
2、/etc/shadow
will
1 root: $ 1 $ CUZfPWNP $ jl8w3 / this / qtjjBfa.urF /: 18216 : 0 : 99999 : 7 :::
changed to
will
1 page.title = _("Administration") 2 page.order = 10 3 page.sysauth = "root" 4 page.sysauth_authenticator = "htmlauth" 5 page.ucidata = true 6 page.index = true 7 page.target = firstnode()
changed to
1 page.title = _("Administration") 2 page.order = 10 3 page.sysauth = "name" 4 page.sysauth_authenticator = "htmlauth" 5 page.ucidata = true 6 page.index = true 7 page.target = firstnode()
4、/etc/config/rpcd
will
1 option username 'root' 2 option password '$p$root'
changed to
1 option username 'name' 2 option password '$p$name'
Thus, a simple user name changes have been completed modifications. If you need web login page does not automatically fill in user name, you only need to change:
5, / usr / lib / lua / luci / view / sysauth.htm
will
1 <input class="cbi-input-text" type="text" name="luci_username" value="<%=duser%" />
changed to
1 <input class="cbi-input-text" type="text" name="luci_username" value="" />
Third, change the user name in source code development environment (following the above steps in a one-step modification of the development board)
1、./openwrt/package/base-files/files/etc/passwd 2、./openwrt/package/base-files/files/etc/shadow 3、./openwrt/feeds/luci/modules/luci-base/luasrc/controller/admin/index.lua 4、./openwrt/package/system/rpcd/files/rpcd.config 5、./openwrt/feeds/luci/modules/luci-base/luasrc/view/sysauth.htm
Thus, after the compilation is completed programming to the development board, or modified name is also displayed in the web client. finished editing.
Fourth, openwrt modify the host name (in username, for example)
1, modify the development board
The / etc / config / system of
1 option hostname OpenWrt 2 option timezone UTC
changed to
1 option hostname username 2 option timezone UTC
Then reboot restart.
2, modify the file in the development of source code
./openwrt/package/base-files/files/etc/config/system
Modifications are the same as above.
V. openwrt into the terminal through the serial port tool requires a user name and password
1, modify the development board
The file / usr / libexec / login
1 #!/bin/sh 2 [ "$(uci -q get system.@system[0].ttylogin)" = 1 ] || exec /bin/ash --login 3 exec /bin/login
changed to
1 #!/bin/sh 2 [ "$(uci -q get system.@system[0].ttylogin)" = 1 ] || exec /bin/login 3 exec /bin/login
2, modify the compiler source code file
./package/base-files/files/usr/libexec/login.sh
Modifications described above.