From owner-freebsd-questions@freebsd.org Mon Mar 6 18:58:30 2017 Return-Path: Delivered-To: freebsd-questions@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 3D5EDCFC7CA for ; Mon, 6 Mar 2017 18:58:30 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mailrelay15.qsc.de (mailrelay15.qsc.de [212.99.187.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.antispameurope.com", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B82CE19BE for ; Mon, 6 Mar 2017 18:58:29 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de ([213.148.129.14]) by mailrelay15.qsc.de; Mon, 06 Mar 2017 19:59:37 +0100 Received: from r56.edvax.de (port-92-195-29-65.dynamic.qsc.de [92.195.29.65]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 7CDF03CC3F; Mon, 6 Mar 2017 19:57:59 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id v26IvwoT002096; Mon, 6 Mar 2017 19:57:58 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Mon, 6 Mar 2017 19:57:58 +0100 From: Polytropon To: ASV Cc: freebsd-questions@freebsd.org Subject: Re: /etc/skel doesn't work?! Message-Id: <20170306195758.17d83f1d.freebsd@edvax.de> In-Reply-To: <1488813922.11457.12.camel@inhio.net> References: <1488813922.11457.12.camel@inhio.net> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-cloud-security-sender: freebsd@edvax.de X-cloud-security-recipient: freebsd-questions@freebsd.org X-cloud-security-Virusscan: CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mailrelay15.qsc.de with EEF1469F437 X-cloud-security-connect: mx01.qsc.de[213.148.129.14], TLS=1, IP=213.148.129.14 X-cloud-security: scantime:.2449 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Mar 2017 18:58:30 -0000 On Mon, 06 Mar 2017 12:25:22 -0300, ASV wrote: > Hello there, > I haven't use this standard functionality for ages but yesterday I > suddenly needed and then I've tried ... and failed. > Further reading led me to add files that I want to be added on any new > user home dir in /usr/share/skel/dot(filename). >=20 > For example: to make my customised .zshrc copied on any new user home > dir I'd just copy the .zshrc file in question to > /usr/share/skel/dot.zshrc and it will be copied with the proper rights > without the prepending "dot". > And that works! At the "top level", a real dot needs to be escaped with "dot.", both for files and directories. Within directories, files can be named "as is". A little sidenote: If you want to make users participate in the use of a customized C shell configuration, you can use the global /etc/csh.cshrc and leave the user's .cshrc (dot.cshrc in the skel/ directory) empty for individual overrides. Advantage: When you improve /etc/csh.cshrc, all users will immediately have that improvement, too. > Nonetheless, according to my understanding, any file placed into > /etc/skel should end up into the newly created user home directory but > it does NOT. > Doesn't matter how the file is named. As I said, there is a specific naming convention that applies both to /usr/share/skel and /etc/skel content. You can make the adduser program use /etc/skel instead of /usr/share/skel in case you don't want to "pollute" that directory. :-) You can find details in "man adduser" and "man pw", which I'd like to quote from the -m option: This option instructs pw to attempt to create the user's home directory. While primarily useful when adding a new account with useradd, this may also be of use when moving an existing user's home directory elsewhere on the file system. The new home directory is populated with the con- tents of the skeleton directory, which typically contains a set of shell configuration files that the user may person- alize to taste. Files in this directory are usually named dot. where the dot prefix will be stripped. When -m is used on an account with usermod, existing configura- tion files in the user's home directory are not overwritten from the skeleton files. This section clearly states the convention of the "dot" prefix. > Looks like a bug to me. No, it doesn't. :-) > My machine:=A0FreeBSD 11.0-RELEASE-p2 (amd64) > Command used:=A0pw useradd -m Correct. > P.S. would be interesting to know why "dot" is required to be prepended > in files added in /usr/share/skel Convention, because the copying routine uses this replacement for "real" files (source/dot.* -> target/.*) whereas it ignores hidden file (source/.*); I don't know why, but you can have hidden files in the skel/ directories which are ignored at its top level. --=20 Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...