I am trying to run an application (code-server) as a sudo user. This application is basically allowing me to run Visual Studio Code online. I created the service file as below: (
[Unit] Description=Running Visual Studio Code Online [Service] User=dev001 Group=dev001 WorkingDirectory=/home/dev001/projects Type=simple ExecStart=/usr/bin/sudo /usr/bin/vsc.sh [Install] WantedBy=multi-user.target
As you can see that the service file has the user and group information.
here is the script I want to run as service (
cd /home/dev001/projects code-server -p 80 --allow-http --password somepassword
It runs fine but the problem is that the user who is running the process is still kept as root, but working as dev001. here is the screenshot of the terminal access via the running service:
Please help me if you have any solution to the problem.
I have taken the nginx help to do a port forward (reverse proxy) to resolve the issue, until code-server gets matured and have the daemonised support for running directly on port 80 or 443. The one benefit I got with this approach is that I am able to install the letsencrypt ssl. so no my environment is all running as I needed to be. There are other issues thought, but they are not related to this thread.