Tuesday, May 30, 2017

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

On May 30, 2017 3:37:05 AM GMT+02:00, Theo Buehler <theo@math.ethz.ch> wrote:
>From: Theo Buehler <theo@math.ethz.ch>
>Cc:
>Bcc:
>Subject: Fwd: siteXX.tgz with /home/user/.ssh/authorized_keys results
>in empty
> file
>Reply-To:
>In-Reply-To:
><f34cb3c3904e4804e52555201c297f97.squirrel@mail.kagu-tsuchi.com>
>
>On Mon, May 29, 2017 at 07:16:06PM -0400, trondd wrote:
>> On Mon, May 29, 2017 5:47 pm, Erling Westenvik wrote:
>> > What is going on? Why is the process extracting siteXX.tgz
>> > treating /mnt/home/user/.ssh different than /mnt/root/.ssh?
>
>[...]
>
>> My guess is this is an install. The installer seems to unpack the
>sets
>> first. Including the site taball. Then, if you created a new user,
>> copies the /etc/skel/ files over, overwriting your authorized_keys
>file.
>> You'll need to use install.site or /etc/rc.firsttime
>>
>> Root is different because root's files are part of the distribution
>sets.
>
>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.
>
>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)

If that's what it does, I'm all for it.

> (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