User account creation

How would I create a user from the command line with a password that will never expire?
traderhank1Asked:
Who is Participating?
 
steveb3210Commented:
The "chage" command will change the expiration of a specific user.

/etc/login.defs defines the default max password age, PASS_MAX_DAYS

When you do adduser, the default password expiry is set to that value.  Change that value to be 99999 for the maximum lenght - I trust your user won't live to be 273years old.

useradd only takes the values in the form of a date, e.g

useradd -e 2299-01-01 bob

would add a user named bob who would expire on January 1st, 2229

I think you really just want to set PASS_MAX_DAYS and you'll be all set.  You might need to reset all the other users in your system if they haven't been all set not to expire..You can do that with

for m in `cat /etc/passwd|awk -F: {'print $1'}`;do chage -M 99999 $m;done

Best Regards,
Stephen
0
 
gtkfreakCommented:
Type the following at command prompt to see the details of the command for adding users:
# man useradd
0
 
traderhank1Author Commented:
that wasn't "exactly" helpfull.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
steveb3210Commented:
Hello,

You can set the password aging limits  by editing /etc/login.defs

You can set the perons's expiry to the maximum with

# passwd -x <username>

Thanks
Stephen
0
 
wesly_chenCommented:
By default,
useradd <username>
passwdd <username>
as root, the password of <username> won't expire unless you enforce on pam.d or /etc/login.defs.
0
 
traderhank1Author Commented:
I don't see anything relating to expiration in login.defs , I don't know anything about pam.d
everytime I create a new user I have to fire-up X and uncheck enable password expiration.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.