2

I'm new to Linux. I have a folder I want to give full access (read, write, delete) to two users. my FTP user and PHP user.

How can I do that?

0

2 Answers 2

4

Create a custom group. Folder is a Windows term for directory. Set the group associated with the directory to be the custom group. Add the group to the two IDs. Make sure any files already in the directory are associated with the group. Perhaps examples would be better - for the examples the users are thing1 and thing2. the custom group chosen is vroom. Remember much of this is done with the root ID (ie use sudo) The full name of the folder is /home/bigshare/house (think of the name of the directory as house)

sudo addgroup vroom
sudo adduser thing1 vroom
sudo adduser thing2 vroom
sudo chgrp vroom /home/bigshare/house
sudo chgrp -R vroom /home/bigshare/house/*
sudo chmod 770 /home/bigshare/house
sudo chmod -R 770 /home/bigshare/house/*

What did we do?

  • made the group (addgroup)
  • allowed thing1 and thing2 to be associated with the group (adduser)
  • made the directory be associated with the group (chgrp)
  • made everything within that directory and beyond be associated with the group (chgrp)
  • set permissions on the directory itself so that only people associated with the directory could work with it (chmod)
  • set permissions of everything under that directory such that only the owner (first 7) or IDs in the group (second 7) can read, write or run the files, as for nobody else can read, write or run files (final digit 0).
1

Add the two users to a custom group and then chgrp on the file or chown on the group to the actual group itself. You can set custom permissions on the file with what the group members can do such as read-only, rwx, etc.

2
  • How can I add users to the custom group?
    – jixodoj
    Oct 18, 2020 at 19:48
  • through GUI or sudo adduser user_name new_group
    – Vasilisa
    Oct 19, 2020 at 13:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .