A week ago, I created a directory by terminal as user root.
Today I logged in as normal user and opened this directory but it said that I don't have permission.
Here is the way to grant permissions for user to read and write on this directory.
Data in this example:
- Directory name "Programming";
- New user group name "newGroup"
- Current login user name "approved"
Step 1: Login as root
su
Step 2: Create new user group
groupadd newGroup
Step 3: Add current user to newGroup
usermod -a -G newGroup approved
Step 4: List all users of newGroup and make sure it contains approved
grep 'Programming' /etc/group
Step 5: Make newGroup as a owner of Programming
chown -hR root:newGroup Programming
Step 6: Grant permission for this group
chmod -R 777 Programming
That's it ^_^
Source:
https://askubuntu.com/questions/487527/give-specific-user-permission-to-write-to-a-folder-using-w-notation
https://www.cyberciti.biz/faq/howto-linux-add-user-to-group/
No comments:
Post a Comment