View | Details | Raw Unified
Collapse All | Expand All

(-) src/useradd.c (-4 / +26 lines)
 Lines 114-120   static int do_grp_update = 0; /* group f Link Here 
static char *Prog;
static char *Prog;
static int
static int
 bflg = 0,			/* new default root of home directory */
    bflg = 0,			/* new default root of home directory */
    cflg = 0,			/* comment (GECOS) field for new account */
    cflg = 0,			/* comment (GECOS) field for new account */
    dflg = 0,			/* home directory for new account */
    dflg = 0,			/* home directory for new account */
    Dflg = 0,			/* set/show new user default values */
    Dflg = 0,			/* set/show new user default values */
 Lines 253-258   static void get_defaults (void) Link Here 
	const struct group *grp;
	const struct group *grp;
	/*
	/*
	 * Pull relevant settings from login.defs first.
	 */
	if (getdef_bool ("USERGROUPS_ENAB"))
		nflg = -1;
	/*
	 * Open the defaults file for reading.
	 * Open the defaults file for reading.
	 */
	 */
 Lines 628-633   static void usage (void) Link Here 
			   "  -K, --key KEY=VALUE		overrides /etc/login.defs defaults\n"
			   "  -K, --key KEY=VALUE		overrides /etc/login.defs defaults\n"
			   "  -m, --create-home		create home directory for the new user\n"
			   "  -m, --create-home		create home directory for the new user\n"
			   "				account\n"
			   "				account\n"
			   "  -n, --user-group		create a new group with the same name as the\n"
			   "				new user\n"
			   "  -o, --non-unique		allow create user with duplicate\n"
			   "  -o, --non-unique		allow create user with duplicate\n"
			   "				(non-unique) UID\n"
			   "				(non-unique) UID\n"
			   "  -p, --password PASSWORD	use encrypted password for the new user\n"
			   "  -p, --password PASSWORD	use encrypted password for the new user\n"
 Lines 1009-1014   static void process_flags (int argc, cha Link Here 
			{"skel", required_argument, NULL, 'k'},
			{"skel", required_argument, NULL, 'k'},
			{"key", required_argument, NULL, 'K'},
			{"key", required_argument, NULL, 'K'},
			{"create-home", no_argument, NULL, 'm'},
			{"create-home", no_argument, NULL, 'm'},
			{"user-group", no_argument, NULL, 'n'},
			{"non-unique", no_argument, NULL, 'o'},
			{"non-unique", no_argument, NULL, 'o'},
			{"password", required_argument, NULL, 'p'},
			{"password", required_argument, NULL, 'p'},
			{"shell", required_argument, NULL, 's'},
			{"shell", required_argument, NULL, 's'},
 Lines 1016-1022   static void process_flags (int argc, cha Link Here 
			{NULL, 0, NULL, '\0'}
			{NULL, 0, NULL, '\0'}
		};
		};
		while ((c =
		while ((c =
			getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:mMop:s:u:",
			getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:mMnop:s:u:",
				     long_options, NULL)) != -1) {
				     long_options, NULL)) != -1) {
			switch (c) {
			switch (c) {
			case 'b':
			case 'b':
 Lines 1156-1161   static void process_flags (int argc, cha Link Here 
			case 'm':
			case 'm':
				mflg++;
				mflg++;
				break;
				break;
			case 'n':
				nflg = 1;
				break;
			case 'o':
			case 'o':
				oflg++;
				oflg++;
				break;
				break;
 Lines 1203-1208   static void process_flags (int argc, cha Link Here 
		usage ();
		usage ();
	/*
	/*
	 * Using --gid and --user-group doesn't make sense.
	 */
	if (nflg == -1 && gflg)
		nflg = 0;
	if (nflg && gflg) {
		fprintf (stderr, _("%s: options -g and -n conflict\n"), Prog);
		exit (E_BAD_ARG);
	}
	/*
	 * Either -D or username is required. Defaults can be set with -D
	 * Either -D or username is required. Defaults can be set with -D
	 * for the -b, -e, -f, -g, -s options only.
	 * for the -b, -e, -f, -g, -s options only.
	 */
	 */
 Lines 1725-1731   int main (int argc, char **argv) Link Here 
	 * to that group, use useradd -g username username.
	 * to that group, use useradd -g username username.
	 * --bero
	 * --bero
	 */
	 */
	if (!gflg) {
	if (nflg) {
		if (getgrnam (user_name)) {
		if (getgrnam (user_name)) {
			fprintf (stderr,
			fprintf (stderr,
				 _
				 _
 Lines 1759-1765   int main (int argc, char **argv) Link Here 
	/* do we have to add a group for that user? This is why we need to
	/* do we have to add a group for that user? This is why we need to
	 * open the group files in the open_files() function  --gafton */
	 * open the group files in the open_files() function  --gafton */
	if (!(nflg || gflg)) {
	if (nflg) {
		find_new_gid ();
		find_new_gid ();
		grp_add ();
		grp_add ();
	}
	}
(-) man/useradd.8.xml (+13 lines)
 Lines 204-209    Link Here 
      </varlistentry>
      </varlistentry>
      <varlistentry>
      <varlistentry>
	<term>
	<term>
	  <option>-n</option>, <option>--user-group</option>
	</term>
	<listitem>
	  <para>
	    Create a new group with the same name as the new user.
	  </para>
	  <para>
	    See the <replaceable>USERGROUPS_ENAB</replaceable> login.defs option for more details.
	  </para>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>
	  <option>-o</option>, <option>--non-unique</option>
	  <option>-o</option>, <option>--non-unique</option>
	</term>
	</term>
	<listitem>
	<listitem>