FreeBSD user home directory

Glen Barber gjb at FreeBSD.org
Wed Jul 20 19:56:53 UTC 2016


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 at do:~ % pwd
> /usr/home/freebsd
> 
> However, the arm build puts the freebsd home directory is under /home/freebsd
> 
> freebsd at 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.

Glen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20160720/f4e7cca5/attachment.sig>


More information about the freebsd-arm mailing list