When I run this command
sudo systemctl enable /home/ec2-user/my_custom.service
Failed to enable unit: Access denied
And When I run
systemctl enable /home/ec2-user/my_custom.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-unit-files ==== Authentication is required to manage system service or unit files. Authenticating as: Cloud User (ec2-user) Password: ==== AUTHENTICATION COMPLETE ==== Failed to enable unit: Access denied
Now here I don’t have any password to setting the new using
sudo passwd ec2-user and then using that password but still the same error
Here is content of my_custom.service
[Unit] Description=go_responder After=network.target [Service] Type=simple User=ec2-user ExecStart=/home/ec2-user/custom_service_executable [Install] WantedBy=default.target
Systemd units must be placed in one of the search paths that systemd looks for unit files in. They cannot be placed in any other directory.
Copy the file to
sudo systemctl daemon-reload and then you will be able to enable your service.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.