useradd [options] {username}
Lets do an example.
Lets add a username guest:
useradd guest

We also need to set password:
passwd rakhi
The account will be in locked status until a password is given

Set account disable date
You can set date for the account to be disabled in the format YYYY-MM-DD with -e option while creating account itself:
useradd -e {yyyy-mm-dd} {username}
example:
useradd -e 2010-12-31 guest

Set default password expiry
The -f {days} option set number of days after the password expires until the account is disabled. (If 0 is specified, the account is disabled immediately after the password expires. If -1 is specified, the account is not be disabled after the password expires.)
useradd -f {days} {username}
example:
useradd -e 2011-12-31 -f 30 guest

For more information look at your man file:
Man useradd

Advertisements