Lesson Plans/Ubuntu/Lesson 3

From Vista Ridge Cyberpatriot
Jump to navigation Jump to search
  1. The / path on a Unix system is also known as the system root directory. While it is possible that other disks and partitions can be mounted onto the file system, every directory or file on the system will stem from this root. You can use the “cd” command to change directory to a different path on the file system and the “ls” command to list the files in that directory. One directory that contains very useful information for debugging a system is /var/log. When it comes to users and groups, the auth.log file under /var/log contains all of the information we need about when a user was created ("new user"), when a group was created ("new group"), when a user logs in, when the “sudo” command is used, and much more. There are many commands that will allow you to view the contents of a file. Use each of the “more”, “less”, “cat” and “grep” commands to determine on what date and time the “cyberpatriot” user was created on this system.
  2. Adding new users is a common system administration activity. Now that you’ve successfully defined your system’s password policy, we can add users to it knowing that chances of an attacker being able to brute force guess their passwords will be relatively low. Let’s create three new users on the system and use our password generator tool (KeePass) to create unique passwords for them that meets or exceeds our new password policy. Give these users the usernames “josh”, “rick”, and “morty”.
  3. When a new user is created, you should see an entry for them in the /etc/passwd file. A new group (with no users) will also be created with their name in the /etc/group file. If those users create a new file, it will be created with their user name as owner and group name by default. But what if I want another user to be able to access the file that I just created? To do this, we need to create a new group where all of those users are members. In this case, the newly created users should all be members of our Cyberpatriot team and we want to be able to give them access to the same resources. Create a new group called “vistaridgecyberpatriots” and add the “cyberpatriot”, “josh”, “rick” and “morty” users to it.
  4. We are going to want a new directory for the team to share their files with each other. Let’s put this new directory under the /opt path and call it “cyberpatriots”. Set the directory to be owned by the cyberpatriot user and the vistaridgecyberpatriots group. You can use the “ls -l” command to view the user and group assigned to the directory.
  5. Create a file under the /opt/cyberpatriots directory and name it “secrets.txt”. Put the string “Password: ThisIsNotASecurePassword” in the file. Set this file to be owned by the cyberpatriot user and the vistaridgecyberpatriots group.
  6. Users are groups are extremely important concepts in Linux for setting the permissions of files and folders and every file and folder has permissions set for the owner, the group, and other (ie. Everyone). For each of these permissions, there are three different rights that you can assign: read, write, and execute. In Linux, these are represented by the characters “r”, “w“ and “x”. So, if I told you that the user had read, write, and execute permissions, that would be represented as the string “rwx”. If I told you that the group had read and execute permission, that would be represented by the string “r-x”. If I told you that other had only read permission, that would be represented by the string “r--“. We typically assemble these smaller 3 character strings into a bigger 9 character string representing all of the rights. So, if we use the examples above, it would be rwxr-xr--. When a directory is created, it receives the “rwxr-xr-x” permission by default, but this means that everyone else can see what’s in the directory. Use the “chmod” command to set permissions on the /opt/cyberpatriots directory to be rwx for the user and group, but --- for other.
  7. When a file is created, it receives the “rw-r--r--“ permission by default, but this means that everyone else can see what’s in the file. Use the “chmod” command to set permissions on the /opt/cyberpatriots/secrets.txt file to remove all permissions for others. Leave the “rw” permission so that the cyberpatriot user can still write to the file and the “r” permission so that anyone in the vistaridgecyberpatriot group can still read it, but not write to it.