Bookmark this page

Lab: Linux Networking and System Resources

Transfer files and connect to remote systems.

Identify running system services and obtain process information.

Outcomes

  • Log in to a remote Linux system.

  • Identify and obtain information for processes running in the system.

  • Compress and extract files and directories.

  • Remotely transfer files.

As the student user on the workstation machine, use the lab command to prepare your environment for this exercise, and to ensure that all required resources are available.

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

Instructions

  1. As the student user on the servera machine, verify whether the tuned system service is active. Save the active status of the tuned service to the ~/service-status.txt file. Find the PID of the firewalld process and save it to the ~/service-pid.txt file.

    Use student as the password for the student user to authenticate to the servera machine.

    1. Log in to the servera machine as the student user. Use student as the password.

      [student@workstation ~]$ ssh student@servera
      student@servera's password: student
      ...output omitted...
      [student@servera ~]$
    2. Verify that the tuned system service is active.

      [student@servera ~]$ systemctl is-active tuned
      active
    3. Save the tuned service status to the ~/service-status.txt file.

      [student@servera ~]$ systemctl is-active tuned > ~/service-status.txt
    4. Find the PID of the firewalld process.

      The PID in your environment might be different.

      [student@servera ~]$ pgrep -f firewalld
      808
    5. Save the PID of the firewalld process to the ~/service-pid.txt file.

      [student@servera ~]$ pgrep -f firewalld > ~/service-pid.txt
  2. On the servera machine, create the ~/Scripts directory. Copy all files that have the string .sh as an extension in the /usr/local/bin/ directory to the ~/Scripts directory.

    1. Create the ~/Scripts directory.

      [student@servera ~]$ mkdir Scripts
    2. Verify the contents of the /usr/local/bin/ directory.

      [student@servera ~]$ ls -l /usr/local/bin/
      total 24
      -rw-r--r--. 1 root root 140 Nov 26 19:05 configure_users.sh
      -rw-r--r--. 1 root root 120 Nov 26 19:05 create.shares.txt
      -rw-r--r--. 1 root root 120 Nov 26 19:05 custom_audio.ksh
      -rw-r--r--. 1 root root 120 Nov 26 19:05 download_documentation_sh
      -rw-r--r--. 1 root root 130 Nov 26 19:05 download_tools.sh
      -rw-r--r--. 1 root root 120 Nov 26 19:05 install_packages.sh
    3. Copy all files in the /usr/local/bin/ directory that have the string .sh as an extension to the ~/Scripts directory.

      [student@servera ~]$ cp /usr/local/bin/*.sh Scripts/
    4. Verify the copied files.

      [student@servera ~]$ ls -l Scripts/
      total 12
      -rw-r--r--. 1 student student 140 Nov 26 19:06 configure_users.sh
      -rw-r--r--. 1 student student 130 Nov 26 19:06 download_tools.sh
      -rw-r--r--. 1 student student 120 Nov 26 19:06 install_packages.sh
  3. On the servera machine, create the ~/my-files.tar.xz compressed file as the backup of the Calendar, Documents, Notes, and Scripts directories. Also include the service-status.txt and service-pid.txt files in the backup. Use either the command line or the Files application to create the backup.

    1. On the command line, use the tar command to create the ~/my-files.tar.xz compressed file. Include the Calendar, Documents, Notes, and Scripts directories, and the service-status.txt and service-pid.txt files in the backup.

      [student@servera ~]$ tar --create --xz --file my-files.tar.xz \
      Calendar/ Documents/ Notes/ Scripts/ service-status.txt service-pid.txt
    2. Alternatively, open the Files application and click Other Locations.

    3. In the Connect to Server field, type ssh:// for the protocol and student@servera for the user and remote server information. Click Connect. Use student as the password.

      Connecting to a remote machine by using the Files application
    4. Select the Calendar. Documents, Notes, and Scripts directories, and the two text files. Right-click the selected files and click Compress.

      Compressing files in a remote machine by using the Files application
    5. Enter my-files as the archive name and select the .tar.xz format from the drop-down list. Click Create.

      Creating an archive by using the Files application
    6. Close the Files application.

  4. On the workstation machine, transfer the ~/my-files.tar.xz file from the servera machine to the home directory of the student user in the workstation machine. Create the Migrated Files directory and use it to extract the my-files.tar.xz file contents.

    1. Exit the servera machine.

      [student@servera ~]$ exit
      logout
      Connection to servera closed.
      [student@workstation ~]$
    2. Transfer the ~/my-files.tar.xz compressed file from the servera machine to the workstation machine. Use student as the password for the student user to authenticate to the servera machine.

      [student@workstation ~]$ scp student@servera:~/my-files.tar.xz ~/
      student@servera's password: student
      my-files.tar.xz
    3. Create the Migrated Files directory.

      [student@workstation ~]$ mkdir Migrated\ Files
    4. Extract the contents of the my-files.tar.xz compressed file to the Migrated Files directory.

      [student@workstation ~]$ tar --extract --xz --file my-files.tar.xz \
      --directory ~/Migrated\ Files
    5. Verify the contents of the Migrated Files directory.

      [student@workstation ~]$ ls -l Migrated\ Files/
      total 8
      drwxr-xr-x. 2 student student 28 Nov 26 18:32 Calendar
      drwxr-xr-x. 2 student student 59 Nov 26 18:32 Documents
      drwxr-xr-x. 2 student student 73 Nov 26 18:32 Notes
      drwxr-xr-x. 2 student student 84 Nov 26 19:06 Scripts
      -rw-r--r--. 1 student student  4 Nov 26 18:57 service-pid.txt
      -rw-r--r--. 1 student student  7 Nov 26 18:55 service-status.txt

Evaluation

As the student user on the workstation machine, use the lab command to grade your work. Correct any reported failures and rerun the command until successful.

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

Finish

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

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

Revision: rh104-9.1-3d1f2bc