2

I am facing issue when installing dotnet sdk on deployment server at the time of deployment using shell scripts. The steps I have followed:

sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' 
sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
sudo apt-get update

I know that I have not root privilege so I can not sudo command in buildpack script. Please let me know how to achieve this some other ways. Quick reply will be appreciated.

Harshal Benake
  • 204
  • 1
  • 14

1 Answers1

2

sudo is required if you want to use the apt packaging system, there is no way round that. You only need to be in the sudoers group to have root privileges via sudo on the default settings.

A partial workaround would be to configure sudo to allow you to sudo for just the apt-get command but this is insecure and may not completely work.

You could ask for an account to be used just for installing, this would then not be used for running services or scripts, this is marginally less risky for the admin but could be secured more heavily because of its particular focus.

This simplest workaround here is to use docker or a virtual machine (assuming its subsystem is already installed, as that will require sudo) to create a slice that you can administer without root. There is a guide here for docker - https://www.microsoft.com/net/core#docker

Ultimately you will be struggling to make this work without root so just go get root or get another box.

A fundamental rule in the unix world is that you must be running as root to serve data on a port numbered less than 1024, this will prevent you from serving on most of the standard ports.

Amias
  • 5,246