Tuesday, May 30, 2017

Re: siteXX.tgz with /home/user/.ssh/authorized_keys results in empty file

On Tue, May 30, 2017 at 03:37:05AM +0200, Theo Buehler wrote:
> Populating the $ADMIN's $_home with some files from siteXX.tgz looks
> like a legitimate use case to me, especially for authorized_keys, but
> also for the dotfiles in /etc/skel.

That was my intuitive (and somewhat limited) understanding of
siteXX.tgz. While echoing some strings to authorized_keys from
install.site is straightforward enough, the "construction" of various
other dotfiles may turn out cumbersome in the long run. I hope your
suggestion turn out feasible.

Thank you to trondd and yourself for making a couple of things clearer
to me.

> How about not overwriting already existing files?
>
> Index: install.sub
> ===================================================================
> RCS file: /var/cvs/src/distrib/miniroot/install.sub,v
> retrieving revision 1.1011
> diff -u -p -r1.1011 install.sub
> --- install.sub 28 May 2017 09:24:56 -0000 1.1011
> +++ install.sub 30 May 2017 00:18:16 -0000
> @@ -2919,7 +2919,7 @@ do_install(){
>
> _home=/mnt$_home
> mkdir -p $_home
> - (cd /mnt/etc/skel; cp -pR . $_home)
> + (cd /mnt/etc/skel; pax -rw -k -pe . $_home)
> (umask 077 && sed "s,^To: root\$,To: ${ADMIN_NAME} <${ADMIN}>," \
> /mnt/var/mail/root >/mnt/var/mail/$ADMIN )
> chown -R 1000:1000 $_home /mnt/var/mail/$ADMIN
>

No comments:

Post a Comment