From owner-freebsd-arm@freebsd.org Wed Jul 20 22:06:58 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 C73C1B9FCFC for ; Wed, 20 Jul 2016 22:06:58 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id B70CD1F14; Wed, 20 Jul 2016 22:06:58 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by freefall.freebsd.org (Postfix) with ESMTP id 7625B1EF9; Wed, 20 Jul 2016 22:06:58 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Wed, 20 Jul 2016 22:06:56 +0000 From: Glen Barber To: Russell Haley Cc: freebsd-arm Subject: Re: FreeBSD user home directory Message-ID: <20160720220656.GG65494@FreeBSD.org> References: <20160720195652.GE65494@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LP3HGykwGcUp63ex" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 11.0-CURRENT amd64 X-SCUD-Definition: Sudden Completely Unexpected Dataloss X-SULE-Definition: Sudden Unexpected Learning Event X-PEKBAC-Definition: Problem Exists, Keyboard Between Admin/Computer User-Agent: Mutt/1.5.24 (2015-08-30) 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:06:58 -0000 --LP3HGykwGcUp63ex Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=3Dmarkup: > >> > > > > 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 'freebs= d', > >> 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. >=20 > 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: >=20 > 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/ >=20 >=20 >=20 > 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/ >=20 > Which seems to me to still be in error as there are now TWO home directo= ries. >=20 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. 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). >=20 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. Glen --LP3HGykwGcUp63ex Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXj/X7AAoJEAMUWKVHj+KTtgAP/jH2JtZllhB4BYfNPlaSozhJ Rt+Wu9K9LRmBWqtKExCx01D5tp1bmRqnOW+T485aCj42IsS/PEq7PHy3dMGaY+1w KKiNo6YCJCUrdnFyLmdtELNeIjVOe9aNNhA4DurPako1jg2EjrnLChW0r6JaSMk1 C8Dl28esE/293HqjBWw8sGob8VdL1YTpqiY52/II8bXTw7V5zj2hYBvqM68sykc6 n2u3SMLq2VGOdG0e4TocWuyeXOK31BgmSZ713WjkRmscWfSJ3lXibzByTsITOvLD OrrtOg+/kjNamAk+Fy2+5XVB5wM93/f8B/vReKxarr/xBcv8T+6+vvHDFV0klNmG uEJTRWGOLoSI30Prmh4UP8c3/7rXWSrblFTw6t1BeO6Tux+7ZMxLlR8GlTWQtOOJ eI5Msk/0J0GyfGmziI7GJsNv/sgisvsFnC9P/VqQmdYt6sDGDJwDG1mIlMAv4YFw LEpLyUQItgKAvRVubI43gb/sRHU75r6vKqLNqnIwlUdrufnGEPb9HX8tpbRG/6fP BBqW9oQlhdkdf0nXEm9vZQvroKmAXrAIM4N1VMjx2XO3ESiIjZ+qHh0/xUamAz2D VPYE5wnYf7/+4Pr9tm03fHCZg8PWnXbQ1dCX6322ePM5BBQtWLDssIbqJboj6kXl 8Acys5W2X9IgvP881vKO =Z3Mx -----END PGP SIGNATURE----- --LP3HGykwGcUp63ex--