Answer the question
In order to leave comments, you need to log in
How to create a user on a remote Ubuntu server and restart the service from under it remotely?
Good afternoon !
There are 2 servers with ubuntu, you need to create a non-privileged user from under which to restart the nginx service.
I did this: I
created a user: useradd -ppass -m -s /bin/bash restart
created a file in sudoers.d\restart
with the following content: restart ALL=NOPASSWD: /bin/systemctl restart nginx
In sshd_config added AllowUsers restart root
rebooted the sshd service
After that I try to reboot from the server with the command: systemctl --host [email protected] restart nginx
I get:
Failed to restart nginx.service: Interactive authentication required.
systemctl --host [email protected] status nginx
Answer the question
In order to leave comments, you need to log in
It looks like you can't do without an explicit ssh call with sudo
https://unix.stackexchange.com/questions/466006/re...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question