Linux Data Management
Learn On Demand
Learn On Demand Pro Series

Time
1 hour
Difficulty
Beginner

This IT Pro Challenges virtual lab teaches learners how to manage Linux files. Learners will understand using Vim, Nano, Gedit, cpio, tar, standard, ACL, and advanced permissions to manage storage. Skills learned in this lab are valuable in multiple job roles such as System Administrator, Exploitation Analyst, Cyber Defense Forensics Analyst, etc.

Start your free 3-day trial and become one of the 3 million Cybersecurity and IT professionals advancing their career goals

Sign up with
Or

Already have an account? Sign In »

Overview

In Linux, most of the actions are executed on files, and to manage these files, Linux has directories also identified as folders, which are supported in a tree-like arrangement.

In this hands-on lab, learners will learn multiple skills such as how to manage files and directories, how to use Vim, Nano, and Gedit, cpio, and tar for backing up and restoring files, how to access data from different parts of the filesystem, and how to configure the standard, ACL, and advanced permissions.

Understand the Scenario

In this virtual lab, you are a system administrator for a company migrating to Linux. Your job is to manage the server's configuration by using text files. You will also back up and restore files, manage directories, and manage storage capacity and standard, special, and ACL permissions. Learners will use a default installation of CentOS 7 Linux on both systems.

Edit text files by using Vim, Nano, and Gedit

In this first section of the virtual lab, learners will learn how to edit text files using vim, nano, and gedit. First, they will open the distribution.txt file in vim. Vim automatically opens into Command Mode. Vim has three modes - Command Mode, Insert Mode and Execute Mode. Insert Mode adds text to the content of the document. The other two modes are used to issue commands to the Vim program. Next, they will switch to Insert Mode and type and place the listed distribution on its line. After this, they will exit Insert Mode and return to Command Mode and switch to Execute Mode and write changes to the disk (save the file), and then quit the Vim program and confirm that the distributions.txt file exists by using the ls command. Learners will follow the same procedure but with different commands to edit text files by using Nano editor and Gedit text editor.

Back up and restore files by using tar and cpio

The tar command is a tape archive. It is the most regularly used tape drive backup command adopted by the Linux/Unix system. It enables users to instantly access a group of files and put them into an extremely compressed archive file. On the other hand, cpio is a more advanced backup tool than tar. It allows the copying of specific files consistently. In this section of the lab, you will learn how to back up and restore files by using tar and cpio. First, you will run the tar command to backup and restore all the files. You will then back up and restore the same files by using cpio. Finally, you will run the "ls" command to check and confirm that all files are restored properly.

Manage files and directories

Managing data in Linux includes creating and deleting directories, creating and deleting files, copying and moving files, and viewing files. In this section of the lab, you will run various commands to manage files and directories. You will run various commands such as :

  • cd to change to the user01 home directory.
  • pwd to display your current location in the filesystem.
  • mkdir to create a new directory named salesdata.
  • touch to create three empty files file1 file2 file3.
  • mkdir to create a subdirectory named July inside the salesdata directory.
  • mv to move the file1 file to the July directory.
  • cp to copy the file2 file to the July directory and rm command to delete file3. - rm command to delete the July directory and all of its contents.

Manage storage

Managing data in Linux includes gathering information about available storage. In this section of the virtual lab, you will run how to manage storage. First, you will get root privileges by using su - root and then run the cat command to display information about storage on the system. Next, you will display partition information by using fdisk and open fdisk to create a new partition. Next, you will select the m option in fdisk to display the menu of available options. Finally, you will display and create the current partition information, new partition, new extended partition, first and last sector and run the partprobe command to update the partition information.

Configure links

Links permit users to access data from different parts of the filesystem. In this section of the lab, learners will learn how to configure links. First, they will create a new file by using Vim and switch to Insert Mode in Vim and then enter the Link Test Document command. Next, they will switch to Command Mode and then save the changes and exit Vim. After this, they will display the contents of the original.txt file, create a hard link to the original.txt file with the hardlink.txt, and display the contents of the hardlink.txt file. Next, they will create a symbolic link to the original.txt file and finally display the contents of the /tmp directory and then observe that the symlink.txt file points to the /root/original.txt file.

Use the find command

The find command searches the actual filesystem, while the locate command uses an index database to search for files. In this section of the virtual lab, you will learn how to use the find command. First, you will verify that your present working directory is the user01 home directory and create a file that can be searched for by using find command. Next, you will search for the /tmp/FindMe.txt file by using the find command and search for files owned by root by using the root owner name. Finally, you will search for files owned by root and then filter the results for .txt files.

Configure standard permissions

Standard Linux permissions are configured by using the chmod command. The command accepts permissions in two formats: Symbolic mode and Absolute mode. In this section of the lab, you will understand both modes. First, you will verify that your present working directory is the root user's home directory. Next, you will create a new directory and move to the permissions directory to create a new directory named DirA and a new file named file1. Next, you will display the current permissions for DirA and file1 and display the permissions changes you have made. After that, you will grant the execute permission to user01 for file1 by using Symbolic mode and remove the read and execute permissions to others for DirA by using Symbolic mode. Next, you will grant the read, write, and execute permissions to the owner and group identities, and remove all permissions for others to file1 by using Absolute mode and again grant the read, write, and execute permissions to the owner, and no access to group and others for DirA by using Absolute mode. Standard permissions only allow you to configure permissions for three identities: user (owner), group, and all others.

Configure ACL permissions

Access Control Lists permit Linux administrators to configure permissions for more than one user and one group. ACLs overcome the limitations of standard permissions. In this section of the lab, learners will learn how to configure ACL permissions. First, you will verify that your present working directory is the /root/permissions directory and then display the current ACL for the file1 file. You should see permissions set only for the root user account and for the root group. Next, you will create a new group named "auditors" and configure an ACL that grants the read permission to the auditor's group for file1 and display the updated ACL for the file1 file. You should see permissions set only for the root user account, the root group, and the auditors group.

Configure advanced permissions

Advanced permissions permit the configuration of the SUID permission to allow users to run commands with the credentials of the owner. The other two advanced permissions are SGID and Sticky Bit. Often, they are used together to permit automatic inheritance of group member access and protecting files from deletion by any user other than the owner. In this section of the lab, you will learn how to configure the advanced permissions. First, you will move to the root user's home directory and create a directory named /projects. Next, you will set a combination of the Sticky Bit and the SGID special permissions on the /projects directory and its contents by using Absolute mode and display the changes to the permissions for the /projects directory. When you run the ls -ld /projects command, your output should include drwxrwSrwT for the directory. This output indicates the SGID and Sticky Bit permissions have been set for the directory. Finally, you will create a simulated script file named script.sh and set the SUID special permission on the script.sh file in the /projects directory by using Symbolic Mode.

Lab Summary Conclusion

After completing the "Linux Data Management" virtual lab, you will have accomplished the following:

  • Used Vim, Nano, and Gedit to edit text files
  • Backed up and restored files by using tar and cpio
  • Managed files and directories
  • Configured links
  • Searched for files by using the find command.
  • Configured standard, ACL, and advanced permissions