How to create user?

Hi,

Quick question.
How to create user in Unix after they login at the first time then they need to change password.

Thanks in Advance :):slight_smile:

It always helps to know what Operating System you are using and in this case whether you are working at a command prompt of through a Systems Administration menu of some sort.

The very general answer is:
After creating the user with "useradd" force the password to expire with "passwd -f".

On AIX you would use smit and just follow the menus. Or if you want to do it on the command line you would use the "mkuser" command.

To set the password you can do "echo "user:n3w_p466w0rd" | /bin/chpasswd"

The AIX default is set so that at first login the system will ask for a new password.

useradd
or smit (aix)
sam (HPUX)

linux
usermod -L username
chage -d 0 username
usermod -U username

user will be required to change password after first login
chage -l username will list properties
~]# chage -l test1
Minimum: 14
Maximum: 90
Warning: 7
Inactive: -1
Last Change: Mar 28, 2011
Password Expires: Jun 26, 2011
Password Inactive: Never
Account Expires: Never

# useradd -u 100 -g other -d /export/home/newuser1 -m -s /bin/ksh -c
"Regular User Account" newuser1