I currently installed Open EdX tutor (nutmeg) on my remote instance via AWS. I am quite new to this so please bear with my low-level programming skills.
I am using a software called PUTTY to reach my instance remotely via SSH.
I installed tutor there and I would like to install additional plugins available such as android, richie, etc. I would like to configure my plugins via VS Code because editing it in putty is quite difficult and I know that the only way to do it so is to clone it in my git-based source code repository hosting service (I am using BITBUCKET on my end), clone it in my local computer, then open it in VS Code. If I finished my changes, I will git pull it from the Bitbucket, then git pull it in my remote instance. But here’s my problem…
I cannot locate the repository of my plugin (for example: the richie plugin) in my instance.
If ever I find it, I don’t know how I could clone it in Bitbucket.
Furthermore, I don’t even know if I can even configure the plugins. I hope someone could help me. Thank you!
Here is a sample SSH config entry to place in your c:\users\MyUser\.ssh\config file (or equivalent on a Mac)
Host edx-dev
# Or use a FQ domain name
HostName 1.2.3.4
User edx
Port 22
# If using an SSH (in Windows), use this syntax.
# You can omit for password-based authentication (I think)
IdentityFile "C:/Users/user/ssh-keys/edx@edx-dev.key"
Then, rebuild your images to include the repository. Once rebuilt to include the new plugin, saving the modified code files in the requirements folder should trigger a recompile.
Thank you for this. I tried this method as well, but the only disadvantage of using this approach is that this method cannot access the hidden files that is accessible in putty. Take note of this as an example:
cd $(tutor config printroot)/env/build/openedx/requirements
I’m not sure that I’m following you entirely. Putty is just an SSH client, similar to using the command prompt to initiate an SSH session. Shell access using modern clients (PuTTY, MobaXterm, VS Code, ssh, etc.) should offer the same functionality. Basically, all SSH connections are equal.
The command tutor config printroot simply prints the location of your Open edX Tutor folder. Encapsulating that command in another command allows for dynamic paths. For example, running this command will print the location of my installation, which is different from yours.
Using Tutor as root might cause some permission or other problems (or so I’ve read). The recommended method is to use a regular user with sudo privileges.
For example:
# This command creates a user called "edx", but you can use any name
useradd -d /home/edx -m edx -s /bin/bash
# Set the password
passwd edx
# Add to sudo group
usermod -aG sudo edx
# Add the non-root user to the docker group
# https://docs.docker.com/engine/install/linux-postinstall/
groupadd docker
usermod -aG docker edx
newgrp docker
If you continue to have problems, you might stop and remove the version in root and then run tutor dev quickstart as your non-root user.
Thank you for this. I clearly understood everything you’ve indicated in this topic. In fact, I’ve followed your instructions and it is a great help. But the problem is still there because I cannot view the hidden directories. To make it clear, my only concern is that the hidden directories/files are not displaying in my VS Code. For an instance, consider these images:
Based on the image above, in my terminal via SSH, I can cd to hidden directories. I entered cd $(tutor config printroot) and it located me to /home/ubuntu/.local/share/tutor
using the ls command, I can view the files inside this directory such as config.yml, data, env
But again. I entered that directory via SSH TERMINAL.
Now I want to go to that same directory in my VS code and view the whole repositories. But here’s what is inside my /home/ubuntu/ directory when I open it via Remote-Containers (Open Folder in Container):
As you can see in the image above, I can’t locate the hidden file .local/share/tutor.
Therefore I cannot open the config.yml file in my VS Code. Take note that my user ubuntu has sudo privileges.
Is there a way where I can view these hidden directories/files via VS Code and not just the SSH terminal???
Now I understand. You can view hidden files and directories using ls -a, or display the file properties in a list using ls -lha
The problem here is that your Tutor installation is likely in /root, not in /home/ubuntu. To work with files in the /root directory in VS Code, you’ll have to log in as root, not as ubuntu. Even though you can su to root in the terminal, the files in the tree are still limited to your non-privileged user. You might have to modify the /root/.ssh/authorized_keys file to allow root SSH login.
Also, even though you are in the /home/ubuntu directory, you changed to root using sudo su. Therefore, the home directory marker ~ will point to /root, not to /home/ubuntu.
You can verify if the files are in your /home/ubuntu directory or not:
ls -lh /home/ubuntu/.local/share/
# Expected output (you should see tutor here).
drwx------ 2 ubuntu ubuntu 4.0K Mar 12 2021 nano
drwxrwxr-x 4 ubuntu ubuntu 4.0K Apr 16 2021 tutor
drwxrwxr-x 3 ubuntu ubuntu4.0K Aug 22 10:05 tutor-plugins
The problem here is that your Tutor installation is likely in /root, not in /home/ubuntu. To work with files in the /root directory in VS Code, you’ll have to log in as root, not as ubuntu. Even though you can su to root in the terminal, the files in the tree are still limited to your non-privileged user. You might have to modify the /root/.ssh/authorized_keys file to allow root SSH login.
Regarding this, I think this might be the problem.
My configuration file appears to be like this:
Host <host_title>
HostName <my_domain>
User ubuntu
Port 22
IdentityFile <my_pem_key>
Should I change anything here? If not, how can I enter the sudo privileges in my Remote-Containers? Is there a detailed instruction to which I can modify the /root/.ssh/authorized_keys file to allow root SSH login?
Duplicate that entry and change the values so that you can log in as root and ubuntu depending. The only thing you will change is the User field.
Host <host_title>
HostName <my_domain>
User root
Port 22
IdentityFile <my_pem_key>
Next, you will need to add your public key from ubuntu to the root profile. Let’s keep it simple and copy the auth key file to root (with the understanding of security risks).
sudo su
cd ~
# verify you are in /root
pwd
# rename the default root authorized_keys file
mv ~/.ssh/authorized_keys ~/.ssh/authorized_keys.bak
# create a copy of the ubuntu user's auth key file
cp /home/ubuntu/.ssh/authorized_keys ~/.ssh/authorized_keys
# verify that both are identical
cat /root/.ssh/authorized_keys
cat /home/ubuntu/.ssh/authorized_keys
I don’t think that the default sshd_config config limits root login, so the above should work.
Later, you should consider adding a layer of security if you will keep the root login open.
# edit the sshd_config and disable root login with a password by adding this setting:
nano /etc/ssh/sshd_config
PermitRootLogin prohibit-password
# test the config (returns an empty result if the config is valid)
sshd -t
# Then, apply the config.
systemctl restart sshd
IT WORKED! I can now access the hidden directories by entering as root user
Now I can also edit the cloned repository added in $(tutor config printroot)/env/build/openedx/requirements (which in my case are plugins) and it is working! By editing these repositories, I can now configure my plugins.
Thank you so much! Will mark your explanation as a Solution now.
I installed tutor there and I would like to install additional plugins available such as android, richie, etc.
I would like to configure my plugins via VS Code because editing it in putty is quite difficult and I know that the only way to do it so is to clone it in my git-based source code repository hosting service I am using BITBUCKET on my end, clone it in my local computer.
Then open it in VS Code. If I finished my changes, I will git pull it from the Bitbucket, then git pull it in my remote instance. But here’s my problem.