[GLLUG] Conditional defaults for new users

Nix nix at esperi.org.uk
Thu Nov 13 22:33:23 UTC 2014

On 23 Oct 2014, T. Menezes said:

> Hi
> I know that you can setup default properties for new users by adding the
> appropriate files to /etc/skel. Can anyone please tell me how I can do it
> as a function of the user group (in Ubuntu, if it makes any difference).

Only by wrapping useradd(8) in a file that invokes, say,

useradd --skel "/etc/skel.group/$(id -g)" "$@"

though it's probably best to do that only if "/etc/skel.group/$(id -g)"
actually exists, and fall back to /etc/skel otherwise.

(Note that some distributions, like Debian, provide an 'adduser' which
itself invokes useradd without providing a way to override the skeleton
directory, or provide GUI front-end tools that do all the work
themselves. This hack won't work in such cases.)

NULL && (void)

More information about the GLLUG mailing list