Lab 10.2.2: Adding Users in Linux Estimated Time: 20 minutes Objective In this lab, the student will learn how to create user accounts using the Linux Red Hat 7.X operating system.. Th
Trang 1Lab 10.2.2: Adding Users in Linux
Estimated Time: 20 minutes
Objective
In this lab, the student will learn how to create user accounts using the Linux Red Hat 7.X operating system
Equipment
The following equipment is required for this exercise:
• Computer with Linux installed
• The computer will boot to the CLI not the GUI (not to X window at startup)
Scenario
The XYZ Company has just installed a server running Linux The company need a IT person to log onto the server and create users
Procedures
Until now, each workstation has acted independently from other computers Each student will create user accounts and these accounts will be used in later labs
To complete the steps below, each student will need to be at the command line If X Window was launched at boot up, then students will need to open a terminal window
Trang 2Step 1: Account Planning
From the drawing below, plan out how many accounts will need to be added
Assign each computer a name, which will also identify its location User accounts may be added to the system name to identify not only the computer but also the user at that location
For example, systemA1 is used by students therefore a user account with the name: studentA1 will be used
Assign a password that is the same as the computer name in order to make the initial login easier
SystemA1 is in the first computer in row
A The computer name (host name) will
be systemA1 and the student account will be studentA1
Trang 3In the space below, write out a user account list Include the computer being worked on
as well
Computer
Name/Location
User Account/Name Password Comments
Example of user accounts and host names
Computer
Name/Location
User Account/Name Password Comments
Windows Computer
Linux Computer
Trang 4Step 2: The useradd Command
At the command prompt, type the command:
man useradd
What do the following switches do?
-c
-d
-e
Does the useradd command create a home directory for the user by default? If so where?
Step 3: The passwd Command
The useradd command by itself does not automatically allow a user to login A
password must first be assigned to the user account This is done with the passwd
command
At the command prompt, type the command:
man passwd
Briefly describe the following passwd switches:
-k
-l -u -d What other means of password protection does the man passwd page discuss?
Trang 5
Step 4: Adding Users
For this step, make sure to be logged in as the root user If not already root, use the su – root command with the root’s password
With the list from step 1, create accounts for all other users in the lab
Example:
Note: Part of the password for these accounts can be found in a dictionary (the word
“student”) Linux will warn against using these passwords for security reasons, but it will accept them All passwords must be entered twice
Notice that in the example above, this is a two-step process First, create the account with the useradd command and then give the new user account a password with the
passwd command
1 Type:
useradd studentXX
(where XX is the username from the table in step 1), and then press Enter
2 Type:
passwd studentXX
Use the student account for the password Linux will ask the user to enter the password twice to check for accuracy
Trang 6Step 5: Account Verification
In this step, verify that the accounts were created correctly in step 4 by using the finger
command
To learn about the finger command type:
man finger
Experiment with the finger command, type:
finger root
Briefly describe the output of this command?
Verify that the accounts were created correctly in step 4 Randomly pick six accounts and use the finger command to see if they were created correctly, List the results in the table below
Account name Verified Y/N
Step 6: Deleting Users
To delete an account, the Linux administrator uses the userdel command Read the man page on the userdel command, type:
man userdel
Describe the –r switch when it is run with the userdel command
To test the userdel command create a temporary account, type:
useradd temp123
Note: This account does not need a password since this is only a temporary account
To see if the account was created, type:
finger temp123
Was a home directory created? Y/N
Next delete the temp account, type:
Trang 7Does the account still exist? Type:
finger temp123
What was the output of this command?
Troubleshooting
To create accounts in Linux, the user must be logged onto the server as an
Administrator If problems are encountered while creating these accounts, verify that the user has the necessary administrative privileges by logging off of the server and logging
on again using the Administrator account
Reflection
Why is it important that only an administrator is allowed to create user accounts?