From owner-freebsd-arm@freebsd.org Wed Jul 20 22:19:34 2016 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B47C9B9FF25 for ; Wed, 20 Jul 2016 22:19:34 +0000 (UTC) (envelope-from russ.haley@gmail.com) Received: from mail-vk0-x229.google.com (mail-vk0-x229.google.com [IPv6:2607:f8b0:400c:c05::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6EE3915D8; Wed, 20 Jul 2016 22:19:34 +0000 (UTC) (envelope-from russ.haley@gmail.com) Received: by mail-vk0-x229.google.com with SMTP id x130so88819196vkc.0; Wed, 20 Jul 2016 15:19:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HLGDT9I0bEG8GY3DGFgPRAWDVchHSKyojl+GzNQFDa0=; b=K/Y2aHruGhpuEuWirU/bmPIrshaJpTVQkyWbf5zhCrfib7RRT6eUY2CqBzod8lqP0w 1NrbfV8QQvOoDYBF1jSMNU4jYOrGjoxWBx2pnpCIwBi04eOR3+MU0Yl0wPSxOIdx5Zmv QP3FJF5SmI8+8jp3ebGxwIW6XUsC82bTDPIQMKJAEIekyEjRpPSncyLSpe+REuDcwWfV Xytt/6voiL+imubaqxzZt4jyoIzDz28HPgjFKtDEF1j/ns2CR4wzb3EYvrgU6kvsM/JR vFwfKbmZGRYpAlSzLH8gF2bt5GVT++vskTmuAdUCUc8NeuYv4F3B10WAP6VBm5YDK6Ns 3Beg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=HLGDT9I0bEG8GY3DGFgPRAWDVchHSKyojl+GzNQFDa0=; b=VGBfrhA+mcofKNEUuASsZRN+vAF1V6j0qnVhevza3yxiJ9Wum4wlIzPg33E2gzESn4 9mNCkyX+GTNihIQTxmAPkLdRcSPvtBJnc8fPbXg4vG4qF2Ct2woVT/h183jJ1j1iArBK bCrbF9QmIG5woIx1MqHzBd2mMqQ+HYRFrosqhuVN9WiPej7zrbzByi4lmdDvIi0akiJD i7a3x+5lH+7IM+jHY8AMw8PNn0fqiVdik6YjO1zbEuFCQQr74OQ2oW2yp46T5aymhVrq 3hEV2hrqh8RLBAhmpszRQ7i5uss+L9dGlUhrGCxR+2HYGNXtDrADuuGK0VGmIayDTwGn mymA== X-Gm-Message-State: ALyK8tJaaororFPOgd9y+p8Ra4Izbq+pM6t8Kks1s5I4kfUuIOoF1m7yrYKaQHuWGiwFyPU8e1v5rJjU62jbNQ== X-Received: by 10.31.185.9 with SMTP id j9mr11893485vkf.144.1469053173092; Wed, 20 Jul 2016 15:19:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.54.75 with HTTP; Wed, 20 Jul 2016 15:19:32 -0700 (PDT) In-Reply-To: <20160720220656.GG65494@FreeBSD.org> References: <20160720195652.GE65494@FreeBSD.org> <20160720220656.GG65494@FreeBSD.org> From: Russell Haley Date: Wed, 20 Jul 2016 16:19:32 -0600 Message-ID: Subject: Re: FreeBSD user home directory To: Glen Barber Cc: freebsd-arm Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2016 22:19:34 -0000 On Wed, Jul 20, 2016 at 4:06 PM, Glen Barber wrote: > On Wed, Jul 20, 2016 at 02:55:23PM -0600, Russell Haley wrote: >> On Wed, Jul 20, 2016 at 1:56 PM, Glen Barber wrote: >> > On Wed, Jul 20, 2016 at 01:45:47PM -0600, Russell Haley wrote: >> >> Hi guys, >> >> >> >> Note: auto-correct on this computer is setting freebsd to FreeBSD. >> >> Please assume lowercase where appropriate if I don't catch them all. >> >> >> >> I've decided to be lazy and just use the default freebsd user with the >> >> stuff I'm doing right now. I have two separate instances running: >> >> 10.2 in a Digital Ocean instance and arm 11-ALPHA-6 on my >> >> Hummingboard. >> >> >> >> The home directory for the FreeBSD user on the 10.2 cloud instance is >> >> in the expected location of /usr/home/freebsd. >> >> >> >> freebsd@do:~ % pwd >> >> /usr/home/freebsd >> >> >> >> However, the arm build puts the freebsd home directory is under /home/freebsd >> >> >> >> freebsd@imx6:~ % pwd >> >> /home/freebsd >> >> >> >> Thanks to a previous conversation with Mikael I have found that the >> >> script /usr/src/release/tools/arm.subr calls function >> >> arm_create_user() which places the user under /home (like debian). >> >> Can someone indicate if this is a mistake (which I think it is) or on >> >> purpose. >> >> From http://svnweb.freebsd.org/base/stable/11/release/tools/arm.subr?view=markup: >> >> >> > >> > No, this was not a mistake. This is from the pw(8) manual: >> > >> > -d dir This option sets the account's home directory. Normally, >> > this is only used if the home directory is to be different >> > from the default determined from /etc/pw.conf - normally >> > /home with the account name as a subdirectory. >> > >> > It's a matter of preference. Some installs will create /home as >> > a symlink to /usr/home, some with /usr/home as a symlink to /home. >> > >> >> 79 arm_create_user() { >> >> 80 # Create a default user account 'freebsd' with the password 'freebsd', >> >> 81 # and set the default password for the 'root' user to 'root'. >> >> 82 chroot ${CHROOTDIR} /usr/sbin/pw -R ${DESTDIR} \ >> >> 83 groupadd freebsd -g 1001 >> >> 84 chroot ${CHROOTDIR} mkdir -p ${DESTDIR}/home/freebsd >> >> 85 chroot ${CHROOTDIR} /usr/sbin/pw -R ${DESTDIR} \ >> >> 86 useradd freebsd \ >> >> 87 -m -M 0755 -w yes -n freebsd -u 1001 -g 1001 -G 0 \ >> >> 88 -c 'FreeBSD User' -d '/home/freebsd' -s '/bin/csh' >> >> 89 chroot ${CHROOTDIR} /usr/sbin/pw -R ${DESTDIR} \ >> >> 90 usermod root -w yes >> >> 91 >> >> 92 return 0 >> >> 93} >> >> >> >> Incidentally, I tried to look up the "correct location" by using man >> >> hier and neither instance indicates that a home folder even exists! I >> >> also believe this to be an oversight. Again, if it is, please let me >> >> know and I will attempt to create the correct problem report and >> >> hopefully at some point some patches (i'm not in my usual environment >> >> so doing stuff with src isn't convenient right now). >> >> >> > >> > With the manual page quote above, I don't think there is any "wrong" >> > behavior here. >> > >> > On your DigitalOcean machine, does /home exist? If so, I suspect it is >> > a symlink. >> >> Thanks for the awesome fast response Glen. Yes, you are correct there >> is a symlink to /home in the DO instance. However in the arm instance >> there are no symlinks in either direction: >> >> freebsd@imx6:/% ll >> total 81 >> -rw-r--r-- 2 root wheel 1481 Jul 1 16:06 .cshrc >> -rw-r--r-- 2 root wheel 750 Jul 1 16:06 .profile >> drwxrwxr-x 2 root operator 512 Jul 1 15:42 .snap/ >> -r--r--r-- 1 root wheel 6190 Jul 1 15:44 COPYRIGHT >> drwxr-xr-x 2 root wheel 1024 Jul 1 15:43 bin/ >> drwxr-xr-x 9 root wheel 1024 Jul 1 17:25 boot/ >> dr-xr-xr-x 17 root wheel 512 Jul 1 17:25 dev/ >> -rw-r--r-- 1 root wheel 4096 Jul 1 17:25 entropy >> drwxr-xr-x 25 root wheel 2560 Jul 2 11:52 etc/ >> drwxr-xr-x 4 root wheel 512 Jul 2 11:52 home/ >> drwxr-xr-x 4 root wheel 1536 Jul 1 15:43 lib/ >> drwxr-xr-x 3 root wheel 512 Jul 1 15:42 libexec/ >> drwxr-xr-x 2 root wheel 512 Jul 1 15:42 media/ >> drwxr-xr-x 2 root wheel 512 Jul 1 15:42 mnt/ >> dr-xr-xr-x 2 root wheel 512 Jul 1 15:42 proc/ >> drwxr-xr-x 2 root wheel 2560 Jul 1 15:43 rescue/ >> drwxr-xr-x 6 root wheel 512 Jul 2 00:02 root/ >> drwxr-xr-x 2 root wheel 2560 Jul 1 15:44 sbin/ >> lrwxr-xr-x 1 root wheel 11 Jul 1 15:42 sys@ -> usr/src/sys >> drwxrwxrwt 7 root wheel 180 Jul 2 09:35 tmp/ >> drwxr-xr-x 15 root wheel 512 Jul 2 11:52 usr/ >> drwxr-xr-x 24 root wheel 512 Jul 1 17:25 var/ >> >> >> >> freebsd@imx6:/usr% ll >> total 76 >> drwxr-xr-x 2 root wheel 8192 Jul 1 15:44 bin/ >> drwxr-xr-x 2 root wheel 512 Jul 2 11:52 home/ >> drwxr-xr-x 54 root wheel 6656 Jul 1 15:43 include/ >> drwxr-xr-x 10 root wheel 15360 Jul 1 15:44 lib/ >> drwxr-xr-x 4 root wheel 512 Jul 1 15:42 lib32/ >> drwxr-xr-x 6 root wheel 512 Jul 1 15:42 libdata/ >> drwxr-xr-x 8 root wheel 1536 Jul 1 15:44 libexec/ >> drwxr-xr-x 14 root wheel 512 Jul 2 00:02 local/ >> drwxr-xr-x 2 root wheel 512 Jul 1 15:42 obj/ >> drwxr-xr-x 2 root wheel 5120 Jul 1 15:44 sbin/ >> drwxr-xr-x 33 root wheel 1024 Jul 1 15:42 share/ >> drwxr-xr-x 2 root wheel 512 Jul 1 15:42 src/ >> drwxr-xr-x 15 root wheel 512 Jul 1 15:44 tests/ >> >> Which seems to me to still be in error as there are now TWO home directories. >> > > This seems strange. On one of my boards, /usr/home does not exist. > > freebsd@rpi2:~ % ls /usr/home > ls: /usr/home: No such file or directory > > In addition, look at the timestamp of your /usr/home. > > Could you do an ls(1) in there? I'm curious what added that. There is no files in the /usr/home directory. freebsd@imx6:/usr/home% ls -l total 0 Both /usr/home and /home were created on July 2, which was the day I created the sd card (I think, the image was posted on July 1). > Anyway, this is easy to fix. >> Maybe I haven't been paying enough attention when generating users but >> I could have sworn that all previous users I create went under >> /usr/home (I know, I'm being pedantic if the symlink exists). >> > > Well, no, you're not being pedantic. This is a "what does the user > expect" issue. Thank you for the report. > > I'll look into this a bit more. Thanks for your help! Russ