仅以特定用户身份重新启动systemd服务?
我创建了一些基本有效的系统服务: 位置: /etc/systemd/system/multi-user.target.wants/publicapi.service 内容: [Unit] Description=public api startup script [Service] Type=oneshot RemainAfterExit=yes EnvironmentFile=-/etc/environment WorkingDirectory=/home/techops ExecStart=/home/techops/publicapi start ExecStop=/home/techops/publicapi stop [Install] WantedBy=multi-user.target 当我尝试在命令行中以techops用户身份重新启动服务时,得到以下输出: ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === Authentication is required to start 'publicapi.service'. Multiple identities can be used for authentication: 1. Myself,,, (defaultuser) 2. ,,, (techops) Choose identity to authenticate as …