How non-root users manage systemd
apt install sudo
/etc/sudoers
Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL fsuser ALL=(ALL:ALL) NOPASSWD: /usr/bin/systemctl start dialer_ms@?*, /usr/bin/systemctl stop dialer_ms@?* # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d
/etc/systemd/system/dialer_ms@.service
[Unit] Description=Start dialer [Service] Type=simple WorkingDirectory=/usr/local/dialer ExecStart=/usr/local/dialer/dialer_ms %I ExecStartPost=fs_cli -x 'bgapi lua /usr/local/freeswitch/scripts/start_camp.lua %I start' ExecReload=/bin/kill -HUP $MAINPID KillMode=process ExecStop= /usr/bin/pkill -f 'dialer_ms %I' ExecStopPost=fs_cli -x 'bgapi lua /usr/local/freeswitch/scripts/start_camp.lua %I stop' Restart=no User=fsuser Group=freeswitch [Install] WantedBy=multi-user.target
Check
su - fsuser sudo systemctl start dialer_ms@<camp_name>.service