[Adduser-devel] Bug#298883: there should be a way to override PASS_MAX_DAYS in useradd

Alexander Gattin Alexander Gattin <arg@online.com.ua>, 298883@bugs.debian.org
Mon, 2 May 2005 02:30:08 +0300


Hi!

I just forgot about a "secret" -O option in
useradd. :)
You can use it to override whatever values from
login.defs

For example, regarding bug #298883, use of:
> `useradd -O PASS_MAX_DAYS=99999 usr298883`
will solve your problem (other solution, that you have
currently implemented, involves `chage`).

Thus closing the bug.

The problem with -O option is a Tomasz's desire to
rename it to -K for sake of unfication with Solaris:

On Thu, Mar 24, 2005 at 11:31:45PM +0100, Tomasz Kłoczko wrote:
> I see some good things in shadow like tools in Solaris and some things I 
> want to integrate on shadow.
...
> All above variables can be used by "useradd -K <key>=<value>".
...
> Current shadow useradd have undocumented -O option. Fragment from
> useradd source code:
> 
>                 case 'O':
>                         /*
>                          * override login.defs defaults (-O name=value)
>                          * example: -O UID_MIN=100 -O UID_MAX=499
>                          * note: -O UID_MIN=10,UID_MAX=499 doesn't work yet
>                          */
>                         cp = strchr (optarg, '=');
>                         if (!cp) {
>                                 fprintf (stderr,
>                                          _("%s: -O requires NAME=VALUE\n"),
>                                          Prog);
>                                 exit (E_BAD_ARG);
>                         }
>                         /* terminate name, point to value */
>                         *cp++ = '\0';
>                         if (putdef_str (optarg, cp) < 0)
>                                 exit (E_BAD_ARG);
>                         break;
> 
> IMO it will be good kill -O an move this to -K.

P.S. now you know the alternatives, at least. ;)

-- 
WBR,
xrgtn