Reputation: 89
On a remote server I can execute a certain command only via "sudo". The authentication is done via a certificate. So when I login via SSH by a bash script, python, ruby or something else, how can I execute a certain command with sudo
?
Upvotes: 1
Views: 273
Reputation: 39437
The proper way of doing this is using a configuration management solution, like ansible
, You can use become
directive to run script/command
with sudo privileges
from a remote client.
If there is only one box or you need to schedule, you can use /etc/crontab
and run it with root
user at desired interval.
Upvotes: 1