User Account Management in Linux
User Account Management in Linux
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
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
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
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
cat /etc/passwd
to verify the changes
View the Above Example Down where I wrote Example in Blue Line if this one fails
Deleting a User
Let's delete the user account for "jane":
This command deletes the user "jane" and removes her home directory with the -r option.
groups john
This command displays the groups that the user "john" belongs to.
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
Example
Let's change the login name from "john" to "Tjoe":