Add an entry of user details in /etc/passwd
The field details are as shown below
# vi /etc/passwd
You will have to create a group with same name. So add a new entry in /etc/group
# vi /etc/group
Assign a password to the user
# passwd user
Changing password for user user.
Retype new password:
passwd: all authentication tokens updated successfully.
Now let us try to login with our newly created user
# su - user
You should see [user@test ~]$ instead of -bash-4.1$ prompt. So why does this happens?
Let us check the contents of its home directory
-bash-4.1$ ls -al
drwxr-xr-x 2 root root 4096 Jan 12 14:27 .
drwxr-xr-x. 3 root root 4096 Jan 12 14:27 ..
So, as you see none of the default contents of a normal user home directory is present like .bashrc, .bash_profile etc.
Final Step 4
NOTE: /etc/skel directory contains all the defaults files which are present inside the home folder of any user
So, copy the contents from /etc/skel inside /home/user using the below command
[root@test ~]# cp -v /etc/skel/.* /home/user/
cp: omitting directory `/etc/skel/.'
cp: omitting directory `/etc/skel/..'
`/etc/skel/.bash_logout' -> `/home/user/.bash_logout'
`/etc/skel/.bash_profile' -> `/home/user/.bash_profile'
`/etc/skel/.bashrc' -> `/home/user/.bashrc'
`/etc/skel/.emacs' -> `/home/user/.emacs'
cp: omitting directory `/etc/skel/.gnome2'
cp: omitting directory `/etc/skel/.mozilla'
Now re login to the user
[root@test user]# su - user
And you are good to go.
But one more thing, did you noticed I didn't touched /etc/shadow file while it also contains all the user related details. As soon as we assign a password to the user an entry for that user is created inside /etc/shadow
# cat /etc/shadow | grep user
Let me know your success and failures
Follow the below links for more tutorialsConfigure Red Hat Cluster using VMware, Quorum Disk, GFS2, Openfiler
Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
How to configure Samba 4 Secondary Domain Controller
How to secure Apache web server in Linux using password (.htaccess)
How to register Red Hat Linux with RHN (Red Hat Network )
Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
15 tips to enhance security of your Linux machine
Why is Linux more secure than windows and any other OS
What is the difference between "su" and "su -" in Linux?
What is swappiness and how do we change its value?
How to log iptables messages in different log file
What are the s and k scripts in the etc rcx.d directories
How to check all the currently running services in Linux
How to auto start service after reboot in Linux
What is virtual memory, paging and swap space?