Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Manage Root access on Jelastic Cloud (to run commands on any container)
This guide details root access to Jelastic Cloud to run commands on any of your containers.
Preamble
- Some Jelastic Cloud containers do not have root access by default
- It is possible to enable this access on the containers of your choice via the installation of an add-on
- Also refer to this other guide if you are looking for information about installing packages without root access.
Enable root access
To do this:
- Log in to your Jelastic Cloud dashboard.
- Click on the Import button from the top menu bar.
- Go to the JPS tab.
- Copy the following code and paste it into the JPS tab:
type: update name: Root Access targetNodes: nodeGroup: '*' onInstall: - cmd[${targetNodes.nodeGroup}]: |- TARGET_UID=$(id -u jelastic 2>/dev/null) || TARGET_UID="700" getent passwd "${TARGET_UID}" &>/dev/null && TARGET_USER=$(getent passwd "${TARGET_UID}" | cut -d: -f1) || TARGET_USER="jelastic" sed -i "\$a${TARGET_USER} ALL=NOPASSWD: ALL" /etc/sudoers; echo ${TARGET_USER} user: root - setGlobals: sudo_user: ${response.out} onUninstall: cmd[${targetNodes.nodeGroup}]: |- sed -i "/${globals.sudo_user} ALL=NOPASSWD: ALL/d" /etc/sudoers user: root
- Click on the Import button.
- Select the environment and the node for which root access is required.
- Click on the Install button.
To then execute commands as root, connect to your application via SSH and run the command sudo su
.
Link to this FAQ: