This question already has an answer here:

I have a Folder in /srv/beta in Server Ubuntu 14.04 to upload source code. How can i set permision all user in dev-team alow all permision only this folder like vim, upload, .... Tks...

marked as duplicate by jasonwryan, Scott, user79743, Anthon, Networker Feb 16 '16 at 7:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Tks very much brother. – Uncelvel Feb 16 '16 at 3:50

You can use CHMOD command for changing the rights or permissions for the folder & CHOWN command for changing the ownership.

For changing the ownership you need to use sudo from root to yourself.

Here is the syntax

To change the ownership for the folder alone.

sudo chown <username>:<groupname> <foldername>

To change the ownership to the folder recursively for all the files and folders inside the folder.

sudo chown -R <username>:<groupname> <foldername>
  • CHMOD and CHOWN will not work as Unix is case sensitive, use chmod and chown. – ctrl-alt-delor Jul 14 '16 at 22:13

Create a group dev-team groupadd dev-team. Add users to that group usermod -G <somegroup>,dev-team <username> Then set an owner to your folder chown someuser:dev-team /srv/beta and chmod 660 /srv/beta so anyone in group dev-team can read and write there.

  • But after that im switch someuser below i can not be used vim to create file in /srv/beta . sudo chown user1:devteam /srv/beta/ sudo chown user2:devteam /srv/beta/ sudo chown user3:devteam /srv/beta/ sudo chmod 660 /srv/beta/ Only User 3 can used vim cli to write file in this folder. – Uncelvel Feb 16 '16 at 4:08
  • Any user in group dev-team (you can add user to group with usermod -G) is allowed to create files in that directory. No need to change owner of a directory. – Lev Bystritskiy Feb 16 '16 at 19:58

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