-1

I want to implement this--

The owner of the folder Work is John. There is another user called Rebeka . [I am the administrator. Both John and Rebeka are standard users (which I created via Terminal)]

Does John automatically have full permission for the folder and it's files as he is the owner?

I want to give Rebeka full permission on the folder Work and it's files, but still the owner will be John, not Rebeka. So, both John and Rebeka will have full permission on the folder Work.

Are the above possible to implement using Terminal? If yes, what will be the command lines?

[P.S: I am using Ubuntu 14.04.5 LTS ]

  • use groups (see your other question) – guiverc Oct 22 '17 at 9:40
1

Yes, the owner of file would have full access. To be exact, owner has access to specify permission levels on the files/ folders, for himself, group and all-others.

I could think of the following steps to solve your scenario.

Create a new group:

sudo groupadd <group name>

Add both users to the group using

sudo usermod -a -G <group name> <user name>

Change group of folder:

chgrp <folder name> <group name> Note: use -hR to set this for all files and directories within

Change permission of the folder:

chmod 770 <folder name>

Essentially this should give full permission rwx to owner(7) and group(7) and no access for all(0). Make sure that the group only has members who need to access the folder. In case you want to add or remove users later, just modify the group.

  • .what is group of folder ? – jabi Oct 22 '17 at 10:25
  • in ubuntu, is each user a group as well? i am very confused :( – jabi Oct 22 '17 at 10:25
  • In unix based systems, each user can be part of one or more groups, and each file has owner level, group level and other(world) permissions. For example, I can run groups command to find all the group that I am part of. – Legolas Oct 22 '17 at 10:40
  • When u run the command ls -l it shows u the permission level of the files in 10 character word (something like this for chmod 770 <folder name> - "drwxrwx---") followed by "owner" and "group" names. The specified owner and group would have permissions as specified by that 10 character keyword. A user who is part of that group gets the group level permissions. – Legolas Oct 22 '17 at 10:48
1

chown can be used to set owner and group for files and folders.
chmod can be used to set permissions.
addgroup --system and adduser can be used to create user groups

Examples

chown John:Rebeka file #this sets John as owner and Rebeka's group as group
chmod 774 file  #this gives owner and group full permission, and others read only permission
addgroup -system workgroup #this creates the group 'workgroup' with no members
adduser Rebeka workgroup #this adds Rebeka to the group workgroup

Reference

https://www.howtoforge.com/linux-chown-command/
https://en.wikipedia.org/wiki/Chmod
http://manpages.ubuntu.com/manpages/trusty/man8/addgroup.8.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.