Bookmark this page

Guided Exercise: Managing File Security from the Command Line

In this lab, you will create a collaborative directory for pre-existing users.

Outcomes

A directory accessible by all members of the ateam group and a file created by Andy that can be modified by Alice.

Reset your serverX system.

  1. Log into the GNOME desktop on serverX as student with a password of student.

  2. Open a window with a Bash prompt.

    Select ApplicationsUtilitiesTerminal.

  3. Become the root user at the shell prompt.

    [student@serverX ~]$ su -
    Password: redhat
  4. Run lab permissions setup which will create a shared group, ateam, with two new users, andy and alice. The password for these accounts is password

    [root@serverX ~]# lab permissions setup
  5. Create a directory in /home called ateam-text.

    [root@serverX ~]# mkdir /home/ateam-text
  6. Change the group ownership of the ateam-text directory to ateam.

    [root@serverX ~]# chown :ateam /home/ateam-text
  7. Ensure the permissions of ateam-text allows group members to create and delete files.

    [root@serverX ~]# chmod g+w /home/ateam-text
  8. Ensure the permissions of ateam-text forbids others from accessing its files.

    [root@serverX ~]# chmod 770 /home/ateam-text
    [root@serverX ~]$ ls -ld /home/ateam-text
    drwxrwx---.  2 root ateam 6 Jan 23 12:50 /home/ateam-text
  9. Exit the root shell and switch to the user andy with a password of password.

    [root@serverX ~]# exit
    [student@serverX ~]$ su - andy
    Password: password
  10. Navigate to the /home/ateam-text folder (remember to open a terminal window first).

    [andy@serverX ~]$ cd /home/ateam-text
  11. Create an empty file called andyfile3.

    [andy@serverX ateam-text]$ touch andyfile3
  12. Record the default user and group ownership of the new file and its permissions.

    [andy@serverX ateam-text]$ ls -l andyfile3
    -rw-rw-r--.  1 andy andy 0 Jan 23 12:59 andyfile3
  13. Change the group ownership of the new file to ateam and record the new ownership and permissions.

    [andy@serverX ateam-text]$ chown :ateam andyfile3
    [andy@serverX ateam-text]$ ls -l andyfile3
    -rw-rw-r--.  1 andy ateam 0 Jan 23 12:59 andyfile3
  14. Exit the shell and switch to the user alice with a password of password.

    [andy@serverX ateam-text]$ exit
    [student@serverX ~]$ su - alice
    Password: password
  15. Navigate to the /home/ateam-text folder.

    [alice@serverX ~]$ cd /home/ateam-text
  16. Determine alice's privileges to access and/or modify andyfile3.

    [alice@serverX ateam-text]$ echo "text" >> andyfile3
    [alice@serverX ateam-text]$ cat andyfile3
    text
Revision: rh124-7-1b00421