I am using GCP instance with Ubuntu 19.04 Minimal on board. I want to run my Node.JS app as a service, I found out that I need to use systemctl.
I created the following .conf file:
[Unit] Description=Node.js Web Parser [Service] ExecStart=/home/user/img/server.js Restart=always User=nogroup Group=nogroup Environment=PATH=/usr/bin:/usr/local/bin Environment=NODE_ENV=production WorkingDirectory=/home/user/img [Install] WantedBy=multi-user.target
sudo cp -i imgparser.service /etc/systemd/system
And when I try to start it
systemctl start imgparser, I get the following error:
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === Authentication is required to start 'img.service'. Authenticating as: Ubuntu (ubuntu) Password: polkit-agent-helper-1: pam_authenticate failed: Authentication failure ==== AUTHENTICATION FAILED === Failed to start imgparser.service: Access denied See system logs and 'systemctl status imgparser.service' for details.
I don’t really know the correct password on this system, though if I correctly set a new password it doesn’t seem to work anyway. Anything I do wrong?