[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#866328: user-setup: allow to preseed the user shell



Hi Luca,

Luca Boccassi <luca.boccassi@gmail.com> (2017-06-28):
> It would be useful to allow preseeding the user shell.
> 
> The use case we have at work is building live Debian images and
> shipping them to users, where we need to have something other than
> bash as the live user shell.
> 
> This could be achieved with hacky posthook scripts that sed
> /etc/passwd, but it just feels wrong :-)
> 
> Attached is a very small and simple patch to add a passwd/user-shell
> configurable option, modeled after passwd/user-uid.

I'm still undecided as to whether this patch is needed/useful in d-i,
but anyway:

>  # Allow preseeding the groups to which the first created user is added
>  Template: passwd/user-default-groups
>  Type: string
> diff --git a/user-setup-apply b/user-setup-apply
> index f24ece2..9dfcf55 100755
> --- a/user-setup-apply
> +++ b/user-setup-apply
> @@ -109,6 +109,16 @@ if [ "$RET" = true ] && ! is_system_user; then
>  		UIDOPT=
>  	fi
>  
> +	if db_get passwd/user-shell && [ "$RET" ]; then
> +		if [ -x $ROOT/usr/sbin/adduser ]; then
> +			SHELLOPT="--shell $RET"
> +		else
> +			SHELLOPT="-s $RET"
> +		fi
> +	else
> +		SHELLOPT=
> +	fi
> +

This distinction doesn't seem needed? I see this in useradd's manpage
from jessie to sid:
       -s, --shell SHELL


KiBi.

Attachment: signature.asc
Description: Digital signature


Reply to: