Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jul 2016 22:06:56 +0000
From:      Glen Barber <gjb@FreeBSD.org>
To:        Russell Haley <russ.haley@gmail.com>
Cc:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: FreeBSD user home directory
Message-ID:  <20160720220656.GG65494@FreeBSD.org>
In-Reply-To: <CABx9NuTsNapLMkk4-gEbAFB--xc488KunUMy9tg-bt71Us_agQ@mail.gmail.com>
References:  <CABx9NuQr2h3iG%2BwSBObr4ap2RZLGt1zBRPWKXwy8RU3%2BASjAwg@mail.gmail.com> <20160720195652.GE65494@FreeBSD.org> <CABx9NuTsNapLMkk4-gEbAFB--xc488KunUMy9tg-bt71Us_agQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160720220656.GG65494>