-
First, create a directory that you want to set the access permissions for. For example, you can create a new directory named
my_directory
:1 mkdir my_directory
-
Next, you need to find the User ID (UID) and Group ID (GID) of the user that you want to grant specific access permissions to. Ensure to replace
username
with the actual username of the user:1 id username
This command will return the UID and GID of the specified user.
-
Now, you can set the access permissions for the directory using Access Control Lists (ACLs). To perform this, use or execute the following syntax. Replace
my_directory
with the actual name of the directory,uid
with the UID of the user, andgid
with the GID of the user:1 setfacl -R -m u:uid:rwx,g:gid:rwx my_directory
This command sets the read, write, and execute permissions for the owner and the group of the
my_directory
directory. The-R
option ensures that the permissions are applied recursively to all files and subdirectories within the directory. -
Finally, you can verify that the access permissions have been correctly set by running the following command:
1 getfacl my_directory
This command will display the current access permissions for the
my_directory
directory.
To revoke access permissions, you can use the following command. Replace my_directory
with the actual name of the directory, uid
with the UID of the user, and gid
with the GID of the user:
1 setfacl -R -x u:uid,g:gid my_directory
This command removes the read, write, and execute permissions for the owner and the group of the my_directory
directory. The -R
option ensures that the permissions are removed recursively from all files and subdirectories within the directory.
Please note that using ACLs in Ubuntu can be complex, and you should be careful when setting access permissions for important files and directories.
About Author
Discover more from SURFCLOUD TECHNOLOGY
Subscribe to get the latest posts sent to your email.