Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Setting Permissions | Users, Roles and The Permissions
Linux Basics

Setting PermissionsSetting Permissions

In this section, we will explore the process of configuring access rights in Linux, providing you with the necessary knowledge for effectively controlling who has access to your information. From understanding basic concepts to practical examples of access rights configuration, this section will help you ensure the security of your system and data.

Video Description
  1. Creating two users (Programmer and their colleague):

    sudo adduser programmer
    sudo adduser colleague

    During the creation of each user, you may be prompted to enter additional details such as a password and other information.

  2. Switching to the first user:

    su programmer
  3. cd /home/programmer/Documents
  4. Creating a file on behalf of the first user:

    touch program.txt
  5. Setting file permissions:

    chmod u=rw,g=r,o=- program.txt
  6. Writing text to the file on behalf of the first user:

    echo "print('Hi')" > program.txt
  7. Switching to the second user:

    su colleague
  8. Attempting to edit the file on behalf of the second user (to demonstrate restricted permissions):

    nano program.txt

In Ubuntu, individual users, groups, and other users have default access permissions. Here are some key details:

  1. File Owner: Has all access rights: read, write, and execute (rwx);
  2. File Group: Typically has read and write permissions (rw);
  3. Other Users: Have only the right to read (r).

These permissions can be modified using the chmod command.

Explanation of Parameters

Image Description
Value Explanation
u Owner of the file
g Group to which the file belongs
o Others (non-owner users of the system)
a All users (owner, group, and others)
+ Add permissions
- Remove permissions
= Set permissions
r Read permission
w Write permission
x Execute permission

The command chmod u=rw,g=r,o=- myfile.txt sets the following permissions for the file myfile.txt:

  1. The user (owner) gets read and write permissions (rw);
  2. The group gets read permission (r);
  3. Others have no access (-).

This command strictly limits access to the myfile.txt file, allowing only the owner to read and write to it, while allowing the group to read and denying access to all other users.

Everything was clear?

Section 4. Chapter 4
course content

Course Content

Linux Basics

Setting PermissionsSetting Permissions

In this section, we will explore the process of configuring access rights in Linux, providing you with the necessary knowledge for effectively controlling who has access to your information. From understanding basic concepts to practical examples of access rights configuration, this section will help you ensure the security of your system and data.

Video Description
  1. Creating two users (Programmer and their colleague):

    sudo adduser programmer
    sudo adduser colleague

    During the creation of each user, you may be prompted to enter additional details such as a password and other information.

  2. Switching to the first user:

    su programmer
  3. cd /home/programmer/Documents
  4. Creating a file on behalf of the first user:

    touch program.txt
  5. Setting file permissions:

    chmod u=rw,g=r,o=- program.txt
  6. Writing text to the file on behalf of the first user:

    echo "print('Hi')" > program.txt
  7. Switching to the second user:

    su colleague
  8. Attempting to edit the file on behalf of the second user (to demonstrate restricted permissions):

    nano program.txt

In Ubuntu, individual users, groups, and other users have default access permissions. Here are some key details:

  1. File Owner: Has all access rights: read, write, and execute (rwx);
  2. File Group: Typically has read and write permissions (rw);
  3. Other Users: Have only the right to read (r).

These permissions can be modified using the chmod command.

Explanation of Parameters

Image Description
Value Explanation
u Owner of the file
g Group to which the file belongs
o Others (non-owner users of the system)
a All users (owner, group, and others)
+ Add permissions
- Remove permissions
= Set permissions
r Read permission
w Write permission
x Execute permission

The command chmod u=rw,g=r,o=- myfile.txt sets the following permissions for the file myfile.txt:

  1. The user (owner) gets read and write permissions (rw);
  2. The group gets read permission (r);
  3. Others have no access (-).

This command strictly limits access to the myfile.txt file, allowing only the owner to read and write to it, while allowing the group to read and denying access to all other users.

Everything was clear?

Section 4. Chapter 4
some-alt