Skip to main content

How to Give User Access to Folder in Linux

Page 1

Often Linux developers and system administrators need to modify file and folder permissions to give and revoke user access in Linux. You can easily do this using chown and chmod command. In this article, we will learn how to give user access to folder in Linux. These commands are freely available on all Linux distributions and can be used accordingly.

How to Give User Access to Folder in Linux Please note, only an admin or superuser or privileged user can modify file and folder permissions in Linux.

1. Using Chown Here is a sample command of chown command to easily change the ownership of folder. $ chown -R test_user:test_group /home/data

The above command sets the owner of /home/data directory to test_user and group to test_group. We have used -R option to recursively change ownership of all sub directories and files in the /home/data directory. The user group is optional. If you want to change only file owner and not user group, you can omit it. $ sudo chown -R test_user /home/data

2. Using chmod Once you have changed the ownership of file or directory, you can change its permissions using chmod command. Here is the syntax of chmod command. $ chmod permission_mode folder_path

The permission mode can have read, write and execute values represented by text, numeric and symbolic methods. Each file/directory has separate permissions for user, group and all. The owner of file/directory is denoted using u, group using g and other using o. In the text method, we specify permissions using alphabets r, w and x for read, write and execute respectively. We use + sign to add permission and – sign to


Turn static files into dynamic content formats.

Create a flipbook
How to Give User Access to Folder in Linux by Techosha - Issuu