How to change user Password Expiry, Home Directory etc in Linux

When we create a new user in linux by default the user's home directory is created inside /home but

we can change the default login directory so that everytime a user is created, their home directory will be created inside some other specified location.

Here is how you can do the same.

# less /etc/default/useradd
# useradd defaults file GROUP=100 HOME=/home INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes
you can make all the required modifications related to default login shell, home directory and many other features.

you can check some of the details of the user using this command
# finger user1
Login: user1                            Name:
Directory: /home/user1                  Shell: /bin/bash
Last login Mon Aug 19 18:35 (IST) on pts/2 from 115.115.207.222
No mail.
No Plan.

Changing default password related parameters when a user is created.

# less /etc/login.defs
MAIL_DIR        /var/spool/mail
#MAIL_FILE      .mail

# Password aging controls:
#
#       PASS_MAX_DAYS   Maximum number of days a password may be used.
#       PASS_MIN_DAYS   Minimum number of days allowed between password changes.
#       PASS_MIN_LEN    Minimum acceptable password length.
#       PASS_WARN_AGE   Number of days warning given before a password expires.
#
PASS_MAX_DAYS   99999
PASS_MIN_DAYS   0
PASS_MIN_LEN    5
PASS_WARN_AGE   7

#
# Min/max values for automatic uid selection in useradd
#
UID_MIN                   500
UID_MAX                 60000

#
# Min/max values for automatic gid selection in groupadd
#
GID_MIN                   500
GID_MAX                 60000

Changing default UID or GID related parameters when a user or group is created.

# less /etc/login.defs
# Min/max values for automatic uid selection in useradd
#
UID_MIN 500
UID_MAX 60000

# Min/max values for automatic gid selection in groupadd
#
GID_MIN 500
GID_MAX 60000

 Changing home directory of already existing users

# usermod -d /path_to_newdir username
for eg:
# usermod -d /new/test/ deepak
Now the home directory of deepak has been changed to /new/test but I would advise to use
# usermod -m -d /path_to_newdir username
In this case -m switch will move all the contents from the user's existing home directory to his new directory

Follow the below links for more tutorials
What is a Kernel in Linux?
How does a DNS query works when you type a URL on your browser?
How to create password less ssh connection for multiple non-root users
How to create user without useradd command in Linux
How to unlink/delete a symbolic in Linux
How to give normal user root privileges using sudo in Linux/Unix
How to do Ethernet/NIC bonding/teaming in Red Hat Linux
How to install/uninstall/upgrade rpm package with/without dependencies
Multiple connections to a server or shared resource by same user
How to extract files to different directory using tar in Unix/Linux
How to preserve Symbolic links with tar command in Unix/Linux