Date: Wed, 20 Jul 2016 14:55:23 -0600 From: Russell Haley <russ.haley@gmail.com> To: Glen Barber <gjb@freebsd.org> Cc: freebsd-arm <freebsd-arm@freebsd.org> Subject: Re: FreeBSD user home directory Message-ID: <CABx9NuTsNapLMkk4-gEbAFB--xc488KunUMy9tg-bt71Us_agQ@mail.gmail.com> In-Reply-To: <20160720195652.GE65494@FreeBSD.org> References: <CABx9NuQr2h3iG%2BwSBObr4ap2RZLGt1zBRPWKXwy8RU3%2BASjAwg@mail.gmail.com> <20160720195652.GE65494@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jul 20, 2016 at 1:56 PM, Glen Barber <gjb@freebsd.org> 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. 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). Thanks Russ
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABx9NuTsNapLMkk4-gEbAFB--xc488KunUMy9tg-bt71Us_agQ>