Knowledge base
1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!
Manage Root access on Jelastic Cloud (to execute commands on any container)
This guide details how to enable root access to your Jelastic Cloud to execute commands on any of your containers.
Introduction
- Some Jelastic Cloud containers do not have root access enabled by default.
- It is possible to enable this access on the containers of your choice by installing an add-on.
- Also, please refer to this other guide if you are looking for information on installing packages without root access.
Enable root access
To do this:
- Log in to the dashboard of your Jelastic Cloud.
- Click on the Import button from the menu bar at the top.
- 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.
- Choose the environment and the node on which root access is required.
- Click on the Install button.
To then execute commands as root, connect to your application via SSH and enter the command sudo su.
Link to this FAQ: https://faq.infomaniak.com/2346
Has this FAQ been helpful?