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?
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?
addgroup
)adduser
)chgrp
)chgrp
)chmod
)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
).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.