BSD Newsletter.com
   Front | Info | Lists | Newsfeeds | Study Guide | What is BSD?
Advertisement: The OpenBSD PF Packet Filter Book: PF for NetBSD, FreeBSD, DragonFly and OpenBSD

BSD Links
·New Links
·Advocacy
·Drivers
·Events
·Flavours
·FAQs
·Guides
·Programming
·Security
·Software
·User Groups

This is the BSDA Study Guide Book written via a wiki collaboration. This is a work in progress. You may contribute to or discuss this specific page at http://bsdwiki.reedmedia.net/wiki/Control_which_files_are_copied_to_a_new_user__39__s_home_directory_during_account_creation.html.

Control which files are copied to a new user's home directory during account creation

Concept

BSD systems use a "skel" directory containing files which are copied over to a user's home directory when a user account is made. Be aware of the location of the skel directory on each BSD, as well as how to override the copying of its contents during account creation.

Introduction

A number of files control a user's environment; generally these are "sourced" at login to set variables, aliases, shell prompts and other options, but others may hold information used in processing mail or making remote connections. Generally these files (.login, .cshrc, .shrc, .rhosts, .mailrc and maybe some others) are referred to as "dotfiles" (for somewhat obvious reasons - remember also that files that begin with "." are not generally shown by ls).

As a system administrator, you may wish for your users to all have similar environments set up when they log in --- perhaps colorized file listings, customized mail or program aliases, their own executable path, and so on. Rather than teaching all your users to set iup their own dotfiles/environment, or (perhaps worse) editing all the users' dotfiles yourself, BSD systems have a "skeleton directory" where master copies of the dotfiles are stored. By editing the master dotfiles in this "skel" directory, you can do the editing once and then have these files copied to a new user's $HOME during the adduser/useradd process.

Finding the Dotfiles!

The names and locations of the "dotfiles" vary somewhat in each branch of the BSD's. For FreeBSD and DragonFly, look in /usr/share/skel:

FreeBSD$ ls /usr/share/skel
dot.cshrc         dot.login_conf    dot.mailrc        dot.rhosts
dot.login         dot.mail_aliases  dot.profile       dot.shrc

NetBSD and OpenBSD store their "master dotfiles" under /etc/skel.

At one time, OpenBSD stored "dotfiles" in /etc/dotfiles. The fact that their dotfiles were/are really dotfiles confused a few people (collected on the Internet, 2007, an archived discussion from some years before):

OpenBSD$ ls /etc/dotfiles
OpenBSD$

Try using "ls -a":

OpenBSD$ ls -a /etc/dotfiles
.        ..       .cshrc   .login   .mailrc  .profile .rhosts

Examples

Practice Exercises

More information

pw(8), adduser.conf(5), useradd(8) or adduser(8), and usermgmt.conf(5)



Front | Information | Lists | Newsfeeds