How to a Add and Remove User Account on RHEL 6

by ehowstuff on February 15, 2012

In this post, i will share on how to add and remove users from the command-line on Red Hat Enterprise Linux 6 (RHEL 6) server.

1. Adding a New User to an RHEL 6 System.

Get the useradd manual :

[root@rhel6 ~]# man useradd
useradd - create a new user or update default new user information

To creates the new account and the /home/john home directory :

[root@rhel6 ~]# useradd --home /home/ehowstuff ehowstuff

To set the password :

[root@rhel6 ~]# passwd ehowstuff
Changing password for user ehowstuff.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@rhel6 ~]# cat /etc/passwd | grep ehowstuff
ehowstuff:x:501:501::/home/ehowstuff:/bin/bash

[root@rhel6 ~]# cat /etc/group | grep ehowstuff
ehowstuff:x:501:

[root@rhel6 ~]# ls /home | grep ehowstuff
ehowstuff

[root@rhel6 ~]# ls /var/spool/mail | grep ehowstuff
ehowstuff

2. Deleting a User from an RHEL 6 System.

Get userdel manual :

[root@rhel6 ~]# man userdel
userdel - delete a user account and related files

Proper command to remove the user’s account, user’s home directory and mail spool as part of the deletion process :

[root@rhel6 ~]# userdel --remove ehowstuff

Technology Updates, Blogging Tips and How To Guides
Lyrics Collection, Upcoming and Released Albums and Movie Trailers
My Highly Recommended
Watch TV Online, Online TV Channels, Free TV Streaming, Free Internet TV
Professional WordPress Themes and Blogspot Templates Resources
Submit URL for Free, Search Engine Submission, Free URL Submission, Submit URL to Search Engine

Related Posts

Previous post:

Next post: