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
- VPS (used Ubuntu 20.04 VPS while writing this)
- Root access
Overview
- User Creation
- Team-Group Creation
- 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
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:
- Primary group: created at the time of user creation, group-name is same as user-name, listed in - /etc/passwd
- 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>
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
Now team-members can work privately in their individual folders and switch to team-folder to collaborate on code with other team-members
Top comments (0)