You are on page 1of 14

Chapter 5.

When Things Go Wrong

These labs should be performed on the Ubuntu operating system that you
installed in Chapter 1, “Distributions and Key Components.” Before you begin
this lab, log in to the student account that you created during the installation
process.

Lab 5.1 Troubleshooting Linux Issues


You won’t find the answers for this lab directly in the book. Troubleshooting
requires exploring and reading documentation—skills you will develop during
this lab.
STEP 1. Open a terminal window.

STEP 2. Execute the command ls /var/logs.

STEP 3. The command from step 2 fails. Review the error message and
determine why.

STEP 4. What command could you run to determine the correct directory
name?

STEP 5. Execute the correct command to view the directory that contains the
logs.
STEP 6. Run the command head -N 7 /etc/passwd.

STEP 7. The command from step 6 fails. What command could you use to
determine the right option?

STEP 8. Execute the correct command, based on what you learned by reading
the documentation.

STEP 9. Execute the following command: cp /etc/passwd /var.

STEP 10. The command from step 9 fails. What command could you use to
determine the right option?

STEP 11. Based on why the command failed, determine a location where you
can copy this file and run the correct command.
Lab 5.2 Configuring User Notifications
STEP 1. Open a terminal window.

STEP 2. Use the su - command to switch to the root user account (using the
password you set during the installation process for the root user).

STEP 3. Modify the correct file to change the command-line login prompt to
display the current date, the node name, and the number of users
currently logged in to the system.
STEP 4. Modify the correct file to change the network login prompt to display
the message Welcome to this system.
STEP 5. Modify the correct file to display the network login prompt from step
4 when an SSH connection is made.
STEP 6. Execute the following command to restart the SSH server and enable
the changes made in step 5: service ssh restart.

STEP 7. Open a new terminal window.

STEP 8. Test the SSH prompt by logging in to the remote system: ssh
localhost.

STEP 9. Enter the exit command to log out of the SSH connection. (Run this
command only once; running it a second time will result in your
terminal window being closed.)
STEP 10. Return to your original window, in which you are logged in as the
root user. (Keep the terminal window from step 7 open.) Create a
message-of-the-day file that displays Restricted server - only log in
if you have been authorized after a user logs in.

STEP 11. Return to the terminal window that you opened in step 7 and run the
ssh localhost command again to test the message-of-the-day file.

STEP 12. Enter the exit command to log out of the SSH connection. (Run this
command only once; running it a second time will result in your
terminal window being closed.)

STEP 13. Return to your original window in which you are logged in as the
root user. (Keep the terminal window from step 7 open.) Try to send a
message to all terminal windows that says Meeting starts in 5
minutes by executing the following command: wall Meeting starts in
5 minutes

STEP 14. The command in step 13 fails. Review the output of the command
and documentation. When you have identified the problem, perform
the steps needed to send the wall message to all terminal windows.

STEP 15. Re-send the broadcast message from step 14 without displaying the
banner information.

STEP 16. Return to the other terminal window that you opened in step 7 and
stop wall messages from being displayed.

STEP 17. In the terminal window that you are logged in to as the root user,
issue a shutdown command but use the option that will not actually
cause the system to shut down.
Part II User and Group Account
Chapter 6. Managing Group Accounts

These labs should be performed on the Ubuntu operating system that you
installed in Chapter 1, “Distributions and Key Components.” Before you begin
this lab, log in to the student account that you created during the installation
process.

Lab 6.1 Managing Group Accounts


STEP 1. Open a terminal window.

STEP 2. Display the current user’s ID and group membership.

STEP 3. Display the group membership of the root account.

STEP 4. Run the correct command to determine the user owner and group
owner of the /etc/group file.

STEP 5. Display the group account information for the games group.

STEP 6. Display the group password information for the games group.

STEP 7. Run the su - following command to switch to the root account (and
provide the root password when prompted).
STEP 8. Create a new group named test.

STEP 9. Display the group account information for the test group.

STEP 10. Change the group name of the test group to newtest.

STEP 11. Add the student account as a secondary member of the newtest group
without overriding this user’s current group membership.

Lab 6.2 Managing Group Administrators


Scenario: In this lab you will be asked to provide a “goal” rather than be told
specifically which steps to take. It is up to you to achieve the end result based on
what you have learned regarding this topic. Create a new group named eng and
add the student user to this group. Make the student user a group administrator.
To test this, add the bin user to the eng group while logged in as the student user
and then verify this new group membership.
Chapter 7. Managing User Accounts

These labs should be performed on the Ubuntu operating system that you
installed in Chapter 1, “Distributions and Key Components.” Before you begin
this lab, log in to the student account that you created during the installation
process.

Lab 7.1 Managing User Accounts


STEP 1. Open a terminal window.

STEP 2. Execute the correct command to display user account information


(including the login shell and home directory) for the bin account.

STEP 3. Execute the correct command to display user password information


(including the encrypted password and password aging) for the bin
account.

STEP 4. The command in step 3 should have failed. Execute the correct su
command to change your account so the command from step 3 will be
successful when executed.

STEP 5. Create a new user named jake and explicitly use options to create the
home directory /home/jake for this user.

STEP 6. Set a password for the jake user to a password of your choosing.
STEP 7. Run the correct command to display the default values used when a new
account is created.

STEP 8. Using the less command, display the file that contains the password
aging defaults.

STEP 9. Using the less command, display the file that contains the default
login shell.

STEP 10. Delete the jake user and his home directory, using a single command.

Lab 7.2 Securing User Accounts


Scenario: Create a user account named sue with the following restrictions:

Warning
With Ubuntu, some of the options for user account commands are
different from the standard options provided in the book. For this
lab you need to explore the documentation for the specific Ubuntu
distro you installed to discover the correct answer.

The account should have a strong, randomly generated password (consider


using https://passwordsgenerator.net or a similar site to create the
password).
The user should be a secondary member of the games group. The
user’s home directory should be explicitly set as /home/sue. The
user should be forced to change her password every 60 days.
The user should not be allowed to change her password for 2 days after it
has been set.
The password warning field should be set to 10.
The password inactivity period should be set to 60.
The account should be set to expire on January 1, 2025.
This user (and all others) should have a minimum password length of 12
characters.

Lab 7.3 Configuring sudo


Scenario: Allow the sue user the ability to use the apt-get command. Verify this
ability by installing the joe package as the sue user.

You might also like