Linux: File and Directory Permissions Management

Linux: File and Directory Permissions Management

ยท

13 min read

Introduction

Managing file and directory permissions is crucial for maintaining the security and accessibility of data in a Linux system. Properly configuring permissions ensures that sensitive information remains private while allowing authorized users to interact with specific files and directories as needed. In this section, we will explore various scenarios related to creating, modifying, and verifying permissions in Linux.

Tasks

  1. Create a Directory

    Create a directory named "Documents" in the home directory "/home/user."

  2. Create Files inside a Directory

    Create two files, "report.txt" and "presentation.ppt," inside the "Documents" directory with specific permissions.

    "report.txt" should have permissions set to rw-r--r-- (read and write for the owner, and read-only for group and others).

    "presentation.ppt" should have permissions set to rwxr-xr-x (read, write, and execute for the owner, and read and execute for group and others). **

  3. Create a Subdirectory with Specific Permissions

    Inside the "Documents" directory, create a subdirectory named "Photos" with permissions set to rwxrwx--- (read, write, and execute for the owner and group, no access for others).

  4. Create Files inside a Subdirectory

    Create two files, "summer.jpg" and "winter.jpg," inside the "Photos" subdirectory with permissions set to rw-rw-r-- (read and write for the owner and group, and read-only for others).

  5. Create a Directory with Executable Permissions

    Create a directory named "Videos" inside the home directory "/home/user" with permissions set to rwxr-xr-x (read, write, and execute for the owner, and read and execute for group and others).

  6. Create a File inside a Directory with Specific Ownership

    Create a file named "holiday.mp4" inside the "Videos" directory with permissions set to rw-rw-r-- (read and write for the owner and group, and read-only for others). Set the owner of the file to a specific user, and the group to a specific group.

  7. Create Nested Directories

    Create a directory structure as follows:

     /home/user/Documents/ 
      - reports/ 
        - report1.txt 
        - report2.txt 
     - presentations/ 
        - presentation1.ppt
    

    Set appropriate permissions for each file and directory:

    The "Documents" directory should have permissions set to rwxr-xr-x.

    The "reports" and "presentations" directories should have permissions set to rwxrwx---.

    All text files (report1.txt, report2.txt, presentation1.ppt) should have permissions set to rw-r--r--.

  8. Create a Directory with No Access for Others

    Create a directory named "Private" inside the home directory "/home/user" with permissions set to rwx------ (read, write, and execute for the owner, no access for group and others).

  9. Create Files inside a Private Directory

    Create two files, "file1.txt" and "file2.txt," inside the "Private" directory with permissions set to rw------- (read and write for the owner, no access for group and others).

  10. Verify File Permissions

    Check the permissions of the "report.txt" file to ensure it is readable and writable by the owner (user), readable by the group (users), and readable by others.

  11. List Directory Contents and Permissions

    Display the contents of the "/home/user/Documents/" directory along with the permissions associated with each file.

  12. Modify File Permissions

    Change the permissions of the "presentation.ppt" file to allow full access (read, write, and execute) for the owner (user), read and execute access for the group (users), and read and execute access for others.

  13. Change File Ownership

    Transfer ownership of the "summer.jpg" file to a different user, making them the new owner of the file.

  14. Change Group Ownership for Directory

    Assign a specific group "marketing" as the new group owner for the "/home/user/Videos/" directory, ensuring all files and directories inside it inherit the new group ownership.

  15. Adjust Directory Access Rights

    Modify the permissions of the "/home/user/Videos/" directory to grant full access (read, write, and execute) to the owner (user) and the group (users), and read and execute access to others.


Solution

  1. Create a Directory

     ubuntu@~$: mkdir documents
     ubuntu@~$: ls
     documents
    
  2. Create Files inside a Directory

     ubuntu@~$: touch documents/report.txt documents/presentation.ppt
     ubuntu@~$: ls documents/
     presentation.ppt  report.txt
     ubuntu@~$: ls documents/ -al
     total 8
     drwxrwxr-x 2 ubuntu ubuntu 4096 Jul 28 15:28 .
     drwxr-x--- 5 ubuntu ubuntu 4096 Jul 28 15:28 ..
     -rw-rw-r-- 1 ubuntu ubuntu    0 Jul 28 15:28 presentation.ppt
     -rw-rw-r-- 1 ubuntu ubuntu    0 Jul 28 15:28 report.txt
     ubuntu@~$: chmod 644 documents/report.txt 
     ubuntu@~$: ls documents/report.txt -al
     -rw-r--r-- 1 ubuntu ubuntu 0 Jul 28 15:28 documents/report.txt
     ubuntu@~$: chmod 755 documents/presentation.ppt 
     ubuntu@~$: ls documents/presentation.ppt -al
     -rwxr-xr-x 1 ubuntu ubuntu 0 Jul 28 15:28 documents/presentation.ppt
    
  3. Create a Subdirectory with Specific Permissions

     ubuntu@~$: mkdir documents/photos
     ubuntu@~$: ls documents/ -al
     total 12
     drwxrwxr-x 3 ubuntu ubuntu 4096 Jul 28 15:38 .
     drwxr-x--- 5 ubuntu ubuntu 4096 Jul 28 15:28 ..
     drwxrwxr-x 2 ubuntu ubuntu 4096 Jul 28 15:38 photos
     -rwxr-xr-x 1 ubuntu ubuntu    0 Jul 28 15:28 presentation.ppt
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 28 15:28 report.txt
     ubuntu@~$: chmod 770 documents/photos/
     ubuntu@~$: ls documents/ -al
     total 12
     drwxrwxr-x 3 ubuntu ubuntu 4096 Jul 28 15:38 .
     drwxr-x--- 5 ubuntu ubuntu 4096 Jul 28 15:28 ..
     drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:38 photos
     -rwxr-xr-x 1 ubuntu ubuntu    0 Jul 28 15:28 presentation.ppt
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 28 15:28 report.txt
    
  4. Create Files inside a Subdirectory

     ubuntu@~$: cd documents/photos/
     ubuntu@~/documents/photos$: touch summer.jpg winter.jpg
     ubuntu@~/documents/photos$: ls -al
     total 8
     drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:45 .
     drwxrwxr-x 3 ubuntu ubuntu 4096 Jul 28 15:38 ..
     -rw-rw-r-- 1 ubuntu ubuntu    0 Jul 28 15:45 summer.jpg
     -rw-rw-r-- 1 ubuntu ubuntu    0 Jul 28 15:45 winter.jpg
     ubuntu@~/documents/photos$: chmod 664 summer.jpg winter.jpg 
     ubuntu@~/documents/photos$: ls -al
     total 8
     drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:45 .
     drwxrwxr-x 3 ubuntu ubuntu 4096 Jul 28 15:38 ..
     -rw-rw-r-- 1 ubuntu ubuntu    0 Jul 28 15:45 summer.jpg
     -rw-rw-r-- 1 ubuntu ubuntu    0 Jul 28 15:45 winter.jpg
    
  5. Create a Directory with Executable Permissions

     ubuntu@~$: mkdir videos
     ubuntu@~$: ls -al
     total 44
     drwxr-x--- 6 ubuntu ubuntu 4096 Jul 28 15:47 .
     drwxr-xr-x 5 root   root   4096 Jul 27 07:09 ..
     -rw------- 1 ubuntu ubuntu 2666 Jul 28 06:04 .bash_history
     -rw-r--r-- 1 ubuntu ubuntu  220 Jan  6  2022 .bash_logout
     -rw-r--r-- 1 ubuntu ubuntu 3771 Jan  6  2022 .bashrc
     drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:59 .cache
     -rw------- 1 ubuntu ubuntu   20 Jul 27 07:23 .lesshst
     -rw-r--r-- 1 ubuntu ubuntu  807 Jan  6  2022 .profile
     drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:58 .ssh
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 26 17:44 .sudo_as_admin_successful
     drwxrwxr-x 3 ubuntu ubuntu 4096 Jul 28 15:38 documents
     drwxrwxr-x 2 ubuntu ubuntu 4096 Jul 28 15:47 videos
     ubuntu@~$: chmod 755 videos/
     ubuntu@~$: ls -al
     total 44
     drwxr-x--- 6 ubuntu ubuntu 4096 Jul 28 15:47 .
     drwxr-xr-x 5 root   root   4096 Jul 27 07:09 ..
     -rw------- 1 ubuntu ubuntu 2666 Jul 28 06:04 .bash_history
     -rw-r--r-- 1 ubuntu ubuntu  220 Jan  6  2022 .bash_logout
     -rw-r--r-- 1 ubuntu ubuntu 3771 Jan  6  2022 .bashrc
     drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:59 .cache
     -rw------- 1 ubuntu ubuntu   20 Jul 27 07:23 .lesshst
     -rw-r--r-- 1 ubuntu ubuntu  807 Jan  6  2022 .profile
     drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:58 .ssh
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 26 17:44 .sudo_as_admin_successful
     drwxrwxr-x 3 ubuntu ubuntu 4096 Jul 28 15:38 documents
     drwxr-xr-x 2 ubuntu ubuntu 4096 Jul 28 15:47 videos
    
  6. Create a File inside a Directory with Specific Ownership

     ubuntu@~$: cd videos/
     ubuntu@~/videos$: touch holiday.mp4
     ubuntu@~/videos$: ls -al holiday.mp4 
     -rw-rw-r-- 1 ubuntu ubuntu 0 Jul 28 15:50 holiday.mp4
    
  7. Create Nested Directories

     ubuntu@~/videos$: cd ~
     ubuntu@~$: touch documents/reports/report1.txt documents/reports/report2.txt
     touch: cannot touch 'documents/reports/report1.txt': No such file or directory
     touch: cannot touch 'documents/reports/report2.txt': No such file or directory
     ubuntu@~$: mkdir documents/reports
     ubuntu@~$: touch documents/reports/report1.txt documents/reports/report2.txt
     ubuntu@~$: mkdir documents/presentations
     ubuntu@~$: touch documents/presentations/presentation1.ppt
     ubuntu@~$: cd documents/
     ubuntu@~/documents$: tree
     .
     โ”œโ”€โ”€ photos
     โ”‚   โ”œโ”€โ”€ summer.jpg
     โ”‚   โ””โ”€โ”€ winter.jpg
     โ”œโ”€โ”€ presentation.ppt
     โ”œโ”€โ”€ presentations
     โ”‚   โ””โ”€โ”€ presentation1.ppt
     โ”œโ”€โ”€ report.txt
     โ””โ”€โ”€ reports
         โ”œโ”€โ”€ report1.txt
         โ””โ”€โ”€ report2.txt
    
     3 directories, 7 files
    
     ubuntu@~/documents$: cd
     ubuntu@~$: ls -al
     total 44
     drwxr-x--- 6 ubuntu ubuntu 4096 Jul 28 15:47 .
     drwxr-xr-x 5 root   root   4096 Jul 27 07:09 ..
     -rw------- 1 ubuntu ubuntu 2666 Jul 28 06:04 .bash_history
     -rw-r--r-- 1 ubuntu ubuntu  220 Jan  6  2022 .bash_logout
     -rw-r--r-- 1 ubuntu ubuntu 3771 Jan  6  2022 .bashrc
     drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:59 .cache
     -rw------- 1 ubuntu ubuntu   20 Jul 27 07:23 .lesshst
     -rw-r--r-- 1 ubuntu ubuntu  807 Jan  6  2022 .profile
     drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:58 .ssh
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 26 17:44 .sudo_as_admin_successful
     drwxrwxr-x 5 ubuntu ubuntu 4096 Jul 28 15:57 documents
     drwxr-xr-x 2 ubuntu ubuntu 4096 Jul 28 15:50 videos
     ubuntu@~$: chmod 755 documents/
     ubuntu@~$: ls -al
     total 44
     drwxr-x--- 6 ubuntu ubuntu 4096 Jul 28 15:47 .
     drwxr-xr-x 5 root   root   4096 Jul 27 07:09 ..
     -rw------- 1 ubuntu ubuntu 2666 Jul 28 06:04 .bash_history
     -rw-r--r-- 1 ubuntu ubuntu  220 Jan  6  2022 .bash_logout
     -rw-r--r-- 1 ubuntu ubuntu 3771 Jan  6  2022 .bashrc
     drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:59 .cache
     -rw------- 1 ubuntu ubuntu   20 Jul 27 07:23 .lesshst
     -rw-r--r-- 1 ubuntu ubuntu  807 Jan  6  2022 .profile
     drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:58 .ssh
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 26 17:44 .sudo_as_admin_successful
     drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 15:57 documents
     drwxr-xr-x 2 ubuntu ubuntu 4096 Jul 28 15:50 videos
    
     ubuntu@~$: cd documents/
     ubuntu@~/documents$: ls -al
     total 20
     drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 15:57 .
     drwxr-x--- 6 ubuntu ubuntu 4096 Jul 28 15:47 ..
     drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:45 photos
     -rwxr-xr-x 1 ubuntu ubuntu    0 Jul 28 15:28 presentation.ppt
     drwxrwxr-x 2 ubuntu ubuntu 4096 Jul 28 15:58 presentations
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 28 15:28 report.txt
     drwxrwxr-x 2 ubuntu ubuntu 4096 Jul 28 15:57 reports
     ubuntu@~/documents$: chmod 770 reports/ presentations/
     ubuntu@~/documents$: ls -al
     total 20
     drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 15:57 .
     drwxr-x--- 6 ubuntu ubuntu 4096 Jul 28 15:47 ..
     drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:45 photos
     -rwxr-xr-x 1 ubuntu ubuntu    0 Jul 28 15:28 presentation.ppt
     drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:58 presentations
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 28 15:28 report.txt
     drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:57 reports
    
     ubuntu@~/documents$: ls reports/ -al
     total 8
     drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:57 .
     drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 15:57 ..
     -rw-rw-r-- 1 ubuntu ubuntu    0 Jul 28 15:57 report1.txt
     -rw-rw-r-- 1 ubuntu ubuntu    0 Jul 28 15:57 report2.txt
     ubuntu@~/documents$: ls presentations -al
     total 8
     drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:58 .
     drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 15:57 ..
     -rw-rw-r-- 1 ubuntu ubuntu    0 Jul 28 15:58 presentation1.ppt
     ubuntu@~/documents$: chmod 644 reports/report1.txt reports/report2.txt presentations/presentation1.ppt 
     ubuntu@~/documents$: ls reports/ -al
     total 8
     drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:57 .
     drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 15:57 ..
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 28 15:57 report1.txt
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 28 15:57 report2.txt
     ubuntu@~/documents$: ls presentations -al
     total 8
     drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:58 .
     drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 15:57 ..
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 28 15:58 presentation1.ppt
    
  8. Create a Directory with No Access for Others

     ubuntu@~/documents$: cd
     ubuntu@~$: mkdir private
     ubuntu@~$: ls -al
     total 48
     drwxr-x--- 7 ubuntu ubuntu 4096 Jul 28 16:11 .
     drwxr-xr-x 5 root   root   4096 Jul 27 07:09 ..
     -rw------- 1 ubuntu ubuntu 2666 Jul 28 06:04 .bash_history
     -rw-r--r-- 1 ubuntu ubuntu  220 Jan  6  2022 .bash_logout
     -rw-r--r-- 1 ubuntu ubuntu 3771 Jan  6  2022 .bashrc
     drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:59 .cache
     -rw------- 1 ubuntu ubuntu   20 Jul 27 07:23 .lesshst
     -rw-r--r-- 1 ubuntu ubuntu  807 Jan  6  2022 .profile
     drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:58 .ssh
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 26 17:44 .sudo_as_admin_successful
     drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 15:57 documents
     drwxrwxr-x 2 ubuntu ubuntu 4096 Jul 28 16:11 private
     drwxr-xr-x 2 ubuntu ubuntu 4096 Jul 28 15:50 videos
     ubuntu@~$: chmod 700 private/
     ubuntu@~$: ls -al
     total 48
     drwxr-x--- 7 ubuntu ubuntu 4096 Jul 28 16:11 .
     drwxr-xr-x 5 root   root   4096 Jul 27 07:09 ..
     -rw------- 1 ubuntu ubuntu 2666 Jul 28 06:04 .bash_history
     -rw-r--r-- 1 ubuntu ubuntu  220 Jan  6  2022 .bash_logout
     -rw-r--r-- 1 ubuntu ubuntu 3771 Jan  6  2022 .bashrc
     drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:59 .cache
     -rw------- 1 ubuntu ubuntu   20 Jul 27 07:23 .lesshst
     -rw-r--r-- 1 ubuntu ubuntu  807 Jan  6  2022 .profile
     drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:58 .ssh
     -rw-r--r-- 1 ubuntu ubuntu    0 Jul 26 17:44 .sudo_as_admin_successful
     drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 15:57 documents
     drwx------ 2 ubuntu ubuntu 4096 Jul 28 16:11 private
     drwxr-xr-x 2 ubuntu ubuntu 4096 Jul 28 15:50 videos
    
  9. Create Files inside a Private Directory

     ubuntu@~$: cd private/
     ubuntu@~/private$: touch file1.txt file2/.txt
     touch: cannot touch 'file2/.txt': No such file or directory
     ubuntu@~/private$: touch file1.txt file2.txt
     ubuntu@~/private$: ls -al
     total 8
     drwx------ 2 ubuntu ubuntu 4096 Jul 28 16:19 .
     drwxr-x--- 7 ubuntu ubuntu 4096 Jul 28 16:11 ..
     -rw-rw-r-- 1 ubuntu ubuntu    0 Jul 28 16:19 file1.txt
     -rw-rw-r-- 1 ubuntu ubuntu    0 Jul 28 16:19 file2.txt
     ubuntu@~/private$: chmod 600 file1.txt file2.txt 
     ubuntu@~/private$: ls -al
     total 8
     drwx------ 2 ubuntu ubuntu 4096 Jul 28 16:19 .
     drwxr-x--- 7 ubuntu ubuntu 4096 Jul 28 16:11 ..
     -rw------- 1 ubuntu ubuntu    0 Jul 28 16:19 file1.txt
     -rw------- 1 ubuntu ubuntu    0 Jul 28 16:19 file2.txt
    
  10. Verify File Permissions

    ubuntu@~$: ls -al documents/reports/report1.txt 
    -rw-r--r-- 1 ubuntu ubuntu 0 Jul 28 15:57 documents/reports/report1.txt
    
  11. List Directory Contents and Permissions

    ubuntu@~$: ls documents/ -al
    total 20
    drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 15:57 .
    drwxr-x--- 7 ubuntu ubuntu 4096 Jul 28 16:11 ..
    drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:45 photos
    -rwxr-xr-x 1 ubuntu ubuntu    0 Jul 28 15:28 presentation.ppt
    drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:58 presentations
    -rw-r--r-- 1 ubuntu ubuntu    0 Jul 28 15:28 report.txt
    drwxrwx--- 2 ubuntu ubuntu 4096 Jul 28 15:57 reports
    
  12. Modify File Permissions

    ubuntu@~$: ls documents/presentation.ppt -al
    -rwxr-xr-x 1 ubuntu ubuntu 0 Jul 28 15:28 documents/presentation.ppt
    ubuntu@~$: chmod 755 documents/presentation.ppt 
    ubuntu@~$: ls -al documents/presentation.ppt 
    -rwxr-xr-x 1 ubuntu ubuntu 0 Jul 28 15:28 documents/presentation.ppt
    
  13. Change File Ownership

    ubuntu@~$: ls documents/photos/summer.jpg -al
    -rw-rw-r-- 1 ubuntu ubuntu 0 Jul 28 15:45 documents/photos/summer.jpg
    ubuntu@~$: chown alicia documents/photos/summer.jpg 
    chown: changing ownership of 'documents/photos/summer.jpg': Operation not permitted
    ubuntu@~$: ls documents/photos/summer.jpg -al
    -rw-rw-r-- 1 alicia ubuntu 0 Jul 28 15:45 documents/photos/summer.jpg
    
  14. Change Group Ownership for Directory

    ubuntu@~$: ls videos/ -al
    total 8
    drwxr-xr-x 2 ubuntu ubuntu 4096 Jul 28 15:50 .
    drwxr-x--- 7 ubuntu ubuntu 4096 Jul 28 16:11 ..
    -rw-rw-r-- 1 ubuntu ubuntu    0 Jul 28 15:50 holiday.mp4
    ubuntu@~$: ls -al
    total 52
    drwxr-x--- 7 ubuntu ubuntu 4096 Jul 28 16:11 .
    drwxr-xr-x 5 root   root   4096 Jul 27 07:09 ..
    -rw------- 1 ubuntu ubuntu 4223 Jul 28 16:24 .bash_history
    -rw-r--r-- 1 ubuntu ubuntu  220 Jan  6  2022 .bash_logout
    -rw-r--r-- 1 ubuntu ubuntu 3771 Jan  6  2022 .bashrc
    drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:59 .cache
    -rw------- 1 ubuntu ubuntu   20 Jul 27 07:23 .lesshst
    -rw-r--r-- 1 ubuntu ubuntu  807 Jan  6  2022 .profile
    drwx------ 2 ubuntu ubuntu 4096 Jul 26 12:58 .ssh
    -rw-r--r-- 1 ubuntu ubuntu    0 Jul 26 17:44 .sudo_as_admin_successful
    drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 15:57 documents
    drwx------ 2 ubuntu ubuntu 4096 Jul 28 16:19 private
    drwxr-xr-x 2 ubuntu ubuntu 4096 Jul 28 15:50 videos
    ubuntu@~$: sudo chown :marketing videos/ -r
    chown: invalid option -- 'r'
    Try 'chown --help' for more information.
    ubuntu@~$: sudo chown :marketing videos/ -R
    ubuntu@~$: ls videos/ -al
    total 8
    drwxr-xr-x 2 ubuntu marketing 4096 Jul 28 15:50 .
    drwxr-x--- 7 ubuntu ubuntu    4096 Jul 28 16:11 ..
    -rw-rw-r-- 1 ubuntu marketing    0 Jul 28 15:50 holiday.mp4
    
  15. Adjust Directory Access Rights

    ubuntu@~$: ls -al
    total 52
    drwxr-x--- 7 ubuntu ubuntu    4096 Jul 28 16:11 .
    drwxr-xr-x 5 root   root      4096 Jul 27 07:09 ..
    -rw------- 1 ubuntu ubuntu    4223 Jul 28 16:24 .bash_history
    -rw-r--r-- 1 ubuntu ubuntu     220 Jan  6  2022 .bash_logout
    -rw-r--r-- 1 ubuntu ubuntu    3771 Jan  6  2022 .bashrc
    drwx------ 2 ubuntu ubuntu    4096 Jul 26 12:59 .cache
    -rw------- 1 ubuntu ubuntu      20 Jul 27 07:23 .lesshst
    -rw-r--r-- 1 ubuntu ubuntu     807 Jan  6  2022 .profile
    drwx------ 2 ubuntu ubuntu    4096 Jul 26 12:58 .ssh
    -rw-r--r-- 1 ubuntu ubuntu       0 Jul 26 17:44 .sudo_as_admin_successful
    drwxr-xr-x 5 ubuntu ubuntu    4096 Jul 28 15:57 documents
    drwx------ 2 ubuntu ubuntu    4096 Jul 28 16:19 private
    drwxr-xr-x 2 ubuntu marketing 4096 Jul 28 15:50 videos
    ubuntu@~$: chmod 775 videos/
    ubuntu@~$: ls -al
    total 52
    drwxr-x--- 7 ubuntu ubuntu    4096 Jul 28 16:11 .
    drwxr-xr-x 5 root   root      4096 Jul 27 07:09 ..
    -rw------- 1 ubuntu ubuntu    4223 Jul 28 16:24 .bash_history
    -rw-r--r-- 1 ubuntu ubuntu     220 Jan  6  2022 .bash_logout
    -rw-r--r-- 1 ubuntu ubuntu    3771 Jan  6  2022 .bashrc
    drwx------ 2 ubuntu ubuntu    4096 Jul 26 12:59 .cache
    -rw------- 1 ubuntu ubuntu      20 Jul 27 07:23 .lesshst
    -rw-r--r-- 1 ubuntu ubuntu     807 Jan  6  2022 .profile
    drwx------ 2 ubuntu ubuntu    4096 Jul 26 12:58 .ssh
    -rw-r--r-- 1 ubuntu ubuntu       0 Jul 26 17:44 .sudo_as_admin_successful
    drwxr-xr-x 5 ubuntu ubuntu    4096 Jul 28 15:57 documents
    drwx------ 2 ubuntu ubuntu    4096 Jul 28 16:19 private
    drwxrwxr-x 2 ubuntu marketing 4096 Jul 28 15:50 videos
    

    Go back to the main page

    "๐ŸŒฑ Keep learning, and spread the knowledge to inspire others. ๐Ÿš€๐Ÿ’ก"

ย