Bookmark this page

Lab: Introducing Troubleshooting Strategy

Solve a Secure Copy Protocol (SCP) file transfer issue.

Outcomes

You should be able to solve an SCP file transfer issue by using the scientific method.

As the student user on the workstation machine, use the lab command to prepare your systems for this lab.

[student@workstation ~]$ lab start strategy-review

This command creates the necessary files to perform this lab.

Instructions

The student user on workstation reported that they are unable to copy a file from serverb by using SCP.

The user provided the following information:

  • The file that they are trying to copy is /home/student/document.txt.

  • They are trying to copy the file to the student user's home directory on workstation.

  • They are connecting to serverb as the student user.

Note

The purpose of this lab is to implement the scientific method to troubleshoot an issue, regardless of how simple the issue is. Force yourself to exaggerate the process to understand the importance of each step.

  1. Collect relevant information.

    1. Login to serverb and switch to the root user.

      [student@workstation ~]$ ssh student@serverb
      ...output omitted...
      [student@serverb ~]$ sudo -i
      [sudo] password for student: student
      [root@serverb ~]$
    2. Gather information about the sshd service. SCP relies on sshd to function and the status would report any recent errors.

      [root@serverb ~]$ systemctl status sshd.service
      ● sshd.service - OpenSSH server daemon
         Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
         Active: active (running) since Wed 2021-09-15 09:07:20 EDT; 7h ago
      ...output omitted...
    3. Gather information about the /home/student/document.txt file.

      [root@serverb ~]$ ls -l /home/student
      total 0
      -rw-r-----. 1 consultant consultant 0 Sep 20 09:41 document.txt
    4. Gather information about potential SELinux alerts. If the output is blank, then no alerts were found.

      [root@serverb ~]$ cat /var/log/messages | grep sealert
    5. Return to workstation as the student user.

      [root@serverb ~]# exit
      [student@serverb ~]$ exit
      [student@workstation ~]$
    6. From workstation, attempt to re-create the issue.

      [student@workstation ~]$ scp student@serverb:~/document.txt .
      scp: /home/student/document.txt: Permission denied

      Observe the error message and consider the information that you gathered from the previous steps.

  2. Create a problem statement.

    1. The following would be an appropriate problem statement. "Today, the student user reported that they are unable to copy the /home/student/document.txt file from serverb to workstation with the scp command. A permission denied error message can be consistently reproduced."

  3. Formulate testable hypotheses.

    1. The following hypotheses are exaggerated to demonstrate other plausible real-world scenarios. Some of these hypotheses ignore information from the information gathering step for the sake of testing multiple hypotheses.

      • serverb is not reachable over the network. Test by accessing network interfaces with network tools.

      • The sshd process on serverb is not running or is misconfigured. Test by using SSH to log in to the system.

      • SELinux on serverb is preventing the file transfer. Test by temporarily disabling SELinux.

      • /home/student/document.txt has incorrect file permissions. Test by adding read permissions.

  4. Test each hypothesis.

    1. Test the hypothesis that serverb cannot be reached over the network with network tools.

      [student@workstation ~]$ ping serverb
      PING serverb.lab.example.com (172.25.250.11) 56(84) bytes of data.
      64 bytes from serverb.lab.example.com (172.25.250.11): icmp_seq=1 ttl=64 time=0.861 ms
      ...output omitted...

      The hypothesis that serverb is not reachable can be eliminated because the ping command succeeds.

    2. Test the hypothesis that the sshd process on serverb is not running properly by attempting to run a remote SSH command on the system.

      [student@workstation ~]$ ssh student@serverb echo test message on serverb
      test message on serverb

      The hypothesis that the sshd process on serverb is not functioning can be eliminated because the ssh command succeeds.

    3. Test the hypothesis that SELinux on serverb is preventing the file transfer by disabling SELinux.

      [student@workstation ~]$ ssh root@serverb setenforce 0
      [student@workstation ~]$ scp student@serverb:~/document.txt .
      scp: /home/student/document.txt: Permission denied
      [student@workstation ~]$ ssh root@serverb setenforce 1

      The hypothesis that SELinux is preventing the file transfer can be eliminated because disabling SELinux did not resolve the issue. Notice that the change was immediately reversed after it was tested and eliminated as a possible issue.

    4. Test the hypothesis that a file permission issue is preventing the file transfer.

      [student@workstation ~]$ ssh root@serverb chown student:student /home/student/document.txt
      [student@workstation ~]$ scp student@serverb:~/document.txt .
      document.txt                      100%    0     0.0KB/s   00:00

      It appears that the issue was likely caused by incorrect file permissions.

  5. Record and analyze the test results.

    1. Based on the preceding tests, it can be determined that the issue was caused by incorrect file permissions. If none of the tests had succeeded, then the scientific method would have to be repeated with new hypotheses, or the issue would need to be escalated.

  6. Fix and verify the problem resolution.

    1. In this lab's case, no further fixes are required to resolve the issue permanently. The issue can be marked as resolved, given that the current state is the inverse of the problem statement: "Now, the student user reports that they are able to use the scp command to transfer the /home/student/document.txt file from serverb to workstation, without any error messages."

Evaluation

On the workstation machine, use the lab command to grade your work. Correct any reported failures and rerun the script until you receive a passing grade.

[student@workstation ~]$ lab grade strategy-review

Finish

On the workstation machine, use the lab command to complete this exercise. This is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish strategy-review

Revision: rh342-8.4-6dd89bd