0% found this document useful (0 votes)
6 views4 pages

User Account Management in Linux

The document provides a comprehensive guide on user account management in Red Hat Linux, detailing commands for creating, modifying, and deleting user accounts. It emphasizes the necessity of superuser privileges for these operations and includes specific command examples for tasks such as adding users, changing passwords, and managing group memberships. Additionally, it covers locking and unlocking user accounts, as well as changing password expiration settings.

Uploaded by

jessjose590
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

User Account Management in Linux

The document provides a comprehensive guide on user account management in Red Hat Linux, detailing commands for creating, modifying, and deleting user accounts. It emphasizes the necessity of superuser privileges for these operations and includes specific command examples for tasks such as adding users, changing passwords, and managing group memberships. Additionally, it covers locking and unlocking user accounts, as well as changing password expiration settings.

Uploaded by

jessjose590
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

User Account Management in Linux ( RHEL)

Text Written In Red mean you need to give close Attention, blue means examples of
the same thing is below
In Red hat Linux or other Linux Distributions there are certain command that enables or let you to add users as that on a
Windows Os which is known as “net user” followed by the name of the user you preferred to use or are instructed to use
example of this command on a windows pc is

“net user NameOfUser PasswordOfUser /add” give it a try and then let us roll back into our task of the day, Linux(RHEL).

When it comes to Linux they all happens to use the same command across multiple editions or flavors

So in this edition of Linux (Red Hat) the common command on other editions is also used here

 User Account Creation


Notice!!!
To be able to create a user account in the linux enviroments you need to be a
super user that is you need to be an administrator, that’s the system expects you
to know what you’re doing so you will need the Administrator account to do this

To be able to log in as an Administrator you need the system Admin password which is the default administrator
when the system was first created. Below are the steps you need to follow in order to be able to create an account
without any errors rising.

1. su –
2. the “su – “(hyphen) let you to switch into the administrator mode or environments to be able to make changes
to files and other data available on the system

3. useradd -c “techie Geeks” techieGeeks -m –u 1020 -s /bin/bash/

the (useradd -c “techie Geeks” techieGeeks -m –u 1020 -s /bin/bash/ ) let you create a user with the name
techieGeeks and also gives you the chance to specify a full name using the –c “techie Geeks”, the –m let you
specify a home directory, provide one if only you know what you’re doing but if not let the system chose a path
for you or a directory for you, the –u let you specify a user id for the user created, you have the chance to
choose from 1000 upward but now below 1000 and lastly the –s let you specify the bash shell for the user that
allowing it to have access to the bash shell
4. passwd techieGeeks

right after Typing the passwd techieGeeks hit the enter, you should be prompted for a new password, typing in a
password of your choice, just make sure they are characters you will remember later when trying to login after
hitting enter you will be prompted again to re-enter password, repeat the password you 1 st typed in the prompt
and you are good to continue notice!! You might encounter some warning message such as
BAD PASSWORD: The password is shorter than 8 characters
Ignore that and proceed

To verify the Existence of the newly user account created


Use the “cat /etc/passwd” give a space and hit enter to verify it
To view the hash password of the newly created account use the command “cat /etc/shadow”

Aside the “cat” command there are other command that let you do more to minimal viewing of the same thing
that the cat command does, and there are

head -n 10 /etc/passwd

tail -n 10 /etc/passwd

To be able to modify a user account you will need the following command

usermod -l Geeks techieGeeks


the above commands let you change the name of the current user that you created to the newly desired of your
choice and in our side which is Geeks, you can now use the command id Geeks to verify the newly changed
name or “cat /etc/passwd” the -l means login name which the system should be using the next time it logs in
in the case that you want to change the full name of the previous username also you can specify the –c “Geeks
Geeks”

usermod -d Geeks –m techieGeeks


the above command let you change the name of the directory of the home user account for the techieGeeks to
Geeks as specified , the “-d” let you specify the directory and “-m” let you move the contents of the previous
user directory to the new one created

cat /etc/passwd
to verify the changes

View the Above Example Down where I wrote Example in Blue Line if this one fails

To Delete a user use the following command below

“userdel techieGeeks” or any other user account you created


Example userdel username and hit enter

To Create a user Group in Linux we use the commands

“groupadd Sales “ or the preferred group name of your choice


Example ” groupadd groupname” and hit enter

To add a user to a group you have already created use


gpasswd –a techieGeeks Sales

Locking and Unlocking User Account


Let's lock the user account for "jane":
sudo usermod -L jane

And let's unlock it:

sudo usermod -U jane

Deleting a User
Let's delete the user account for "jane":

sudo userdel -r jane

This command deletes the user "jane" and removes her home directory with the -r option.

Managing Group Membership


Let's view the groups for user "john":

groups john

This command displays the groups that the user "john" belongs to.

Changing Password Expiration


Let's set the password expiration for user "john" to 90 days:

sudo chage -M 90 john

Rough Example
To change a user's login name in Red Hat Linux:

Notice!!! During the Practice make sure you have the username created with
the same name as the changing goes else you will get an error message
Steps
1. sudo usermod -l newloginname oldloginname

2. sudo mv /home/oldloginname /home/newloginname (if home directory exists)

3. sudo usermod -d /home/newloginname newloginname (update home directory)

Example
Let's change the login name from "john" to "Tjoe":

1. sudo usermod -l jdoe john


2. sudo mv /home/john /home/jdoe (if home directory exists)
3. sudo usermod -d /home/jdoe jdoe (update home directory)

You might also like