diff mbox series

[v3,3/9] package/dash: add /etc/dash to /etc/shells

Message ID 1516356909-18620-4-git-send-email-romain.naour@smile.fr
State Accepted
Headers show
Series Add /etc/shells handling | expand

Commit Message

Romain Naour Jan. 19, 2018, 10:15 a.m. UTC
When dash is selected, /bin/dash is not added to /etc/shells
(see man shells). So, login tools like dropbear reject the ssh
connections for users using dash as shell in /etc/passwd.

buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
v3: Fix typo (Thomas)
    Use TARGET_FINALIZE_HOOKS to avoid issues with the upcoming
    top-level parallel build (Arnout)
v2: add double-dollar after /bin/dash (Yann)
---
 package/dash/dash.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Yann E. MORIN Feb. 3, 2018, 2:55 p.m. UTC | #1
Romain, All,

On 2018-01-19 11:15 +0100, Romain Naour spake thusly:
> When dash is selected, /bin/dash is not added to /etc/shells
> (see man shells). So, login tools like dropbear reject the ssh
> connections for users using dash as shell in /etc/passwd.
> 
> buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
> v3: Fix typo (Thomas)
>     Use TARGET_FINALIZE_HOOKS to avoid issues with the upcoming
>     top-level parallel build (Arnout)
> v2: add double-dollar after /bin/dash (Yann)
> ---
>  package/dash/dash.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/package/dash/dash.mk b/package/dash/dash.mk
> index c8b4164..2a3fd0d 100644
> --- a/package/dash/dash.mk
> +++ b/package/dash/dash.mk
> @@ -13,4 +13,12 @@ define DASH_INSTALL_TARGET_CMDS
>  	$(INSTALL) -m 0755 $(@D)/src/dash $(TARGET_DIR)/bin/dash
>  endef
>  
> +# Add /bin/dash to /etc/shells otherwise some login tools like dropbear
> +# can reject the user connection. See man shells.
> +define DASH_ADD_DASH_TO_SHELLS
> +	grep -qsE '^/bin/dash$$' $(TARGET_DIR)/etc/shells \
> +		|| echo "/bin/dash" >> $(TARGET_DIR)/etc/shells
> +endef
> +DASH_TARGET_FINALIZE_HOOKS += DASH_ADD_DASH_TO_SHELLS
> +
>  $(eval $(autotools-package))
> -- 
> 2.7.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/package/dash/dash.mk b/package/dash/dash.mk
index c8b4164..2a3fd0d 100644
--- a/package/dash/dash.mk
+++ b/package/dash/dash.mk
@@ -13,4 +13,12 @@  define DASH_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 0755 $(@D)/src/dash $(TARGET_DIR)/bin/dash
 endef
 
+# Add /bin/dash to /etc/shells otherwise some login tools like dropbear
+# can reject the user connection. See man shells.
+define DASH_ADD_DASH_TO_SHELLS
+	grep -qsE '^/bin/dash$$' $(TARGET_DIR)/etc/shells \
+		|| echo "/bin/dash" >> $(TARGET_DIR)/etc/shells
+endef
+DASH_TARGET_FINALIZE_HOOKS += DASH_ADD_DASH_TO_SHELLS
+
 $(eval $(autotools-package))