This note will cover the essential commands to manage machines with multiple users that need to work on the same project owo
Create a User
sudo useradd -m username
Create a group for the project which the user will work on
sudo groupadd groupname
Add the user to the group
sudo usermod -aG groupname username
optional: set the user’s password
sudo passwd username
make your project directory in /var/www/html or /opt
sudo mkdir /var/www/html/projectname
Change the group of the project directory to the group you created
sudo chown -R :groupname /var/www/html/projectname
# or use chgrp
sudo chgrp -R groupname /var/www/html/projectname
# -R is for recursively applying the changes to all files and directories inside the project directory
sudo chmod -R 775 /var/www/html/projectname
Depending on your situation you might need to give read write access to the owner or group. You can do it by chmod g+rw
here g
means group, rw
means read and write. Similarly x
means execution.
chmod rw -R /project/path # For the owner
chmod g+rw -R /project/path # For the group