Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

che.openshift.io - Run the terminal as SUDO

I am using the che.openshift.io - Eclipse Che from Red Hat. I have a workspace of PHP Laravel Stack. When I try to run commands as SUDO from the php terminal I am getting error.

SUDO - not a command /
SU - must be run from a terminal

Can someone help me to run as root user? I have to install the heroku CLI from the terminal which can be done only via root user.

like image 953
Karthika Avatar asked Dec 13 '19 07:12

Karthika


1 Answers

In general, containers running as root is a significant security risk + containers are supposed to be immutable and installing anything inside the container is not recommended since after the restart all the packages will vanish.

Eclipse Che workspaces on che.openshift.io are running against Red Hat OpenShift Online clusters which do not support sudo and workspace containers are running using the Arbitrary User IDs (This provides additional security against processes escaping the container due to a container engine vulnerability and thereby achieving escalated permissions on the host node). So, Basically you can not execute sudo from the workspace terminal.

I have to install the heroku CLI from the terminal which can be done only via root user.

In order to support the Heroku CLI from the terminal you have 2 options:

  • Create your own custom php image with the Heroku CLI installed based on the default php image used in Eclipse Che - https://github.com/eclipse/che-dockerfiles/blob/master/recipes/php/7.1/Dockerfile (and then refer to this image from the custom devfile that will feet your needs)
  • Eclipse Che support vscode extensions and you can contribute support of the heroku-cli to the che-plugin-registry

Hope this helps.

like image 187
Ilya Buziuk Avatar answered Oct 22 '22 23:10

Ilya Buziuk