Same files for different users on same Google Compute Engine VM
I'm very new to GCP and cloud computing in general and also I don't come from a software engineering background, so please excuse me if my language is not completely accurate.
I was working on a project in a Google Compute Engine VM. Now, I wanted to see if a colleague could work on my project, but when he connected to the instance, as it was connected to his user, the instance was empty.
Is there any way to share the same files for different users? Should I create a shared user so we face the same files when connecting? I'm not finding which is the way to do it. Both of us have admin privileges, so that shouldn't be a problem. Any help would be appreciated
Edit: Just to be clear, my goal is that whenever me and/or my colleague connect to our GCE instance, we always share the same folders
Let's say your name is Juan and your collegue is Mary. Each of you login to Google Compute Engine using SSH, which means that your Google User Identity determines your home directory.
Your home directory will look like /home/juan
, Mary's will look like /home/mary
.
The solution is to create a new directory that both of you share access to and enable permissions to both of you.
Change juan and mary below for your actual usernames. The command who
will tell you who you are.
- Create a new group called users (any name you want):
sudo groupadd users
- Add yourself to this group:
sudo usermod -a -G users juan
- Add Mary to this group:
sudo usermod -a -G users mary
- Create a new shared directory (any path you want):
sudo mkdir /home/shared
- Change the group ownership to users:
sudo chgrp users /home/shared
- Give the group users read,write,execute permissions:
sudo chmod 755 /home/shared
No each time you login change to the /home/shared directory and do your work there. If you forget, copy your new files or changed files to the /home/shared directory.