Sobes.tech
Junior — Middle

How can user access to a specific folder in the system be granted or restricted?

sobes.tech AI

Answer from AI

To grant or restrict user access to a specific folder in a system, access rights (permissions) and user and group management are typically used.

In Linux, for example, you can:

  • Use the chmod command to set access rights (read, write, execute) for the owner, group, and others.
  • Use chown to change the owner and group of the folder.
  • Create a user group that is allowed access and assign the folder to this group.
  • Use Access Control Lists (ACLs) for more fine-grained permission settings.

Example:

# Create a group
sudo groupadd project_team

# Add a user to the group
sudo usermod -aG project_team username

# Change the group of the folder
sudo chown :project_team /path/to/folder

# Set permissions: owner and group can read and write, others cannot
sudo chmod 770 /path/to/folder

Thus, only the owner and members of the project_team group will be able to access the folder.

In Windows, access is configured through folder properties — the "Security" tab, where you can add or remove users and assign permissions.