Grant Linux Directory Permissions to a User

To grant permission to a specific user for a directory, you can use the chown command and the chgrp command. Here are the specific steps:

  1. change owner
sudo chown -R username: /path/to/directory

The username refers to the username of the user being authorized, and /path/to/directory is the directory path. The -R option indicates recursively changing the owner of all subdirectories and files.

  1. change group ownership
sudo chgrp -R groupname /path/to/directory

The groupname represents the name of the group to be authorized, and /path/to/directory is the directory path. The -R option indicates recursively changing the ownership group of all subdirectories and files.

This way, designated users can access and modify the directory and its contents.

bannerAds