@@ -69,6 +69,24 @@ config NSH_PROMPT_STRING
6969 Provide the shell prompt string with size limit NSH_PROMPT_MAX.
7070 default is "nsh> ".
7171
72+ config NSH_PROMPT_STRING_ROOT
73+ string "Prompt string for effective root (euid=0)"
74+ default ""
75+ depends on SCHED_USER_IDENTITY
76+ ---help---
77+ If non-empty, NSH uses this prompt when the effective UID is zero.
78+ If empty, the prompt from NSH_PROMPT_STRING (or ENV/HOSTNAME) is used.
79+ Set explicitly for multi-user shells (for example, "nsh# ").
80+
81+ config NSH_PROMPT_STRING_USER
82+ string "Prompt string for non-root effective UID"
83+ default ""
84+ depends on SCHED_USER_IDENTITY
85+ ---help---
86+ If non-empty, NSH uses this prompt when the effective UID is non-zero.
87+ If empty, the prompt from NSH_PROMPT_STRING (or ENV/HOSTNAME) is used.
88+ Set explicitly for multi-user shells (for example, "nsh$ ").
89+
7290config NSH_PROMPT_MAX
7391 int "Maximum Size of Prompt String"
7492 default NAME_MAX
@@ -351,6 +369,21 @@ config NSH_DISABLE_CHOWN
351369 default DEFAULT_SMALL
352370 depends on FS_PERMISSION
353371
372+ config NSH_DISABLE_SU
373+ bool "Disable su"
374+ default DEFAULT_SMALL
375+ depends on SCHED_USER_IDENTITY
376+
377+ config NSH_DISABLE_ID
378+ bool "Disable id"
379+ default DEFAULT_SMALL
380+ depends on SCHED_USER_IDENTITY
381+
382+ config NSH_DISABLE_WHOAMI
383+ bool "Disable whoami"
384+ default DEFAULT_SMALL
385+ depends on SCHED_USER_IDENTITY
386+
354387config NSH_DISABLE_CP
355388 bool "Disable cp"
356389 default DEFAULT_SMALL
@@ -1259,6 +1292,19 @@ config NSH_LOGIN_FAILCOUNT
12591292 ---help---
12601293 Number of login retry attempts.
12611294
1295+ config NSH_LOGIN_SETUID
1296+ bool "Set user identity after successful login"
1297+ default y
1298+ depends on SCHED_USER_IDENTITY
1299+ ---help---
1300+ After a successful NSH login, look up the authenticated user name
1301+ in the passwd database and call setuid()/setgid() so that the shell
1302+ session runs with that user's credentials.
1303+
1304+ When CONFIG_LIBC_PASSWD_FILE is enabled, any user listed in the
1305+ passwd file may be selected. Otherwise only the built-in "root"
1306+ account is supported.
1307+
12621308config NSH_PLATFORM_CHALLENGE
12631309 bool "Platform challenge"
12641310 default n
0 commit comments