DEV Community

Mahesh
Mahesh

Posted on

Cloud development environment for Team

Target

Manage/Create dev-environment on cloud linux-server for a team to avoid local-computer errors and collaborate on code with other team-members

Requirements

  1. VPS (used Ubuntu 20.04 VPS while writing this)
  2. Root access

Overview

  1. User Creation
  2. Team-Group Creation
  3. Team-Folder for team to collaborate

Steps

User Creation

# create user accounts for your team member
useradd --create-home <username>  # create user with directory for him in `/home` with name equal to <username>
passwd <username> # set user password
chmod o-rwx /home/<username> # make folder private, so only folder-owner and root-user can view/modify files
# "o" == others, 
# "-" == remove permissions 
# "r" == read, "w" == write", "x" == execute


# Additonal commands
id <username> # list user's userid(uid) and primary-group(gid) amd secondary-groups(groups)
cat /etc/passwd # list all users
deluser --remove-home <username> # delete user alongwith his directory
cat /etc/passwd # list all users
Enter fullscreen mode Exit fullscreen mode

User can now connect with his folder with ssh and vs-code using command: ssh <username>@<ip-address/domain-name>

Team-Group creation

There are two types of groups primary-group and secondary group:

  1. Primary group: created at the time of user creation, group-name is same as user-name, listed in - /etc/passwd
  2. Secondary group: used to grant certain privileges to a set of users, listed in - /etc/group

We are going to create "Secondary group" here.

groupadd <group-name> # create group
usermod -a -G <group-name> <user-name> # add user to the group, -a == append, -G == group

# Additional commands
cat /etc/group  # list all groups
getent group <group-name> # list all users of a group
groupdel <groupname>
Enter fullscreen mode Exit fullscreen mode

Team-Folder for team to collaborate

mkdir <folder-name> # create a new folder for team
chgrp -R <group-name> <folder-name>  # change group of folder to team-group we created above
chmod g+rwx <folder-name> # give access of folder to it's group
Enter fullscreen mode Exit fullscreen mode

Now team-members can work privately in their individual folders and switch to team-folder to collaborate on code with other team-members

Reference

Top comments (0)