NuttX has support to /etc/passwd to console nsh login, just like almost all Unix outta here, but a developer called Petro (nice Ukrainian developer and human being) found an issue in the TEA crypto algorithm implementation and fixed it:
https://github.com/apache/incubator-nuttx-apps/pull/1097

Unfortunately after this fixing the Console Login of the NuttX simulador stopped to work. Unfortunately nobody noticed it until too later (during the NuttX 10.4.0-RC0 release). Then I found the issue and posted about it on NuttX mailing list. Immediately Petro realized it was caused by his Pull Request above and replied my email.

Then I decided to fix it myself. The first challenge was to find where the /etc/passwd was created. Is the some script to create it? After some investigation I found it at boards/sim/sim/sim/src/etc/passwd.

So my idea was run the command “passwd” and change it like we do in the Linux/Unix. So, the first step was to disable the Console Login in the menuconfig:

$ make menuconfig
Application Configuration --->
NSH Library --->
[ ] Console Login

But my nightmare started after doing it because NuttX has many poke-yoke to prevent users making mistakes.

For example: in apps/nshlib/nsh_passwdcmds.c we have at beginning:

#if !defined(CONFIG_DISABLE_MOUNTPOINT) && \
     defined(CONFIG_NSH_LOGIN_PASSWD) && \
    !defined(CONFIG_FSUTILS_PASSWD_READONLY)
...
#ifndef CONFIG_NSH_DISABLE_USERADD
int cmd_useradd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{

The problem is we disabled the NSH_LOGIN_PASSWD so all commands related to login will not be compiled: useradd, userdel, passwd…

After removing these “#if defined” I compiled again, but the commands didn’t show up. The I need to do the same for apps/nshlib/nsh.h, apps/nshlib/nsh_command.c and apps/nshlib/Makefile.

Finally!!! Now the commands appeared at “nsh>” and I could create the new password to “admin” user:

nsh> ?
help usage:  help [-v] [<cmd>]

  .         cp        exec      losetup   mv        rm        true      usleep    
  [         cmp       exit      ln        passwd    rmdir     truncate  xd        
  ?         dirname   false     ls        poweroff  set       uname     
  basename  dd        free      mkdir     printf    sleep     umount    
  break     df        help      mkfatfs   ps        source    unset     
  cat       dmesg     hexdump   mkrd      pwd       test      useradd   
  cd        echo      kill      mount     readlink  time      userdel   

Builtin Apps:
  sh         dumpstack  hello      nsh        gpio       
nsh> mount
  /bin type binfs
  /etc type romfs
  /proc type procfs
  /tmp type vfat
nsh> umount /etc
nsh> mkfatfs /dev/ram2
nsh> mount -t vfat /dev/ram2 /etc
nsh> echo "admin:8Tv+Hbmr3pLddSjtzL0kwC:0:0:/" > /etc/passwd
nsh> cat /etc/passwd
admin:8Tv+Hbmr3pLddSjtzL0kwC:0:0:/
nsh> passwd admin
nsh: passwd: missing required argument(s)
nsh> passwd admin Administrator
nsh> cat /etc/passwd
admin:8Tv+Hbmr3pLVb5HHZgd26D:0:0:/
nsh>  

Then I just edited the boards/sim/sim/sim/src/etc/passwd and submitted the PR:
https://github.com/apache/incubator-nuttx/pull/6843