I am writing a script that relies on pkexec
as the machine is hardened and sudo
will not work. I allow pkexec
to temporarily not prompt the user for a password, so any command will work directly.
If I manually log in to SSH and have a session open and run a command like: pkexec service iptables restart
it works, however, if I try doing something like ssh [email protected] "pkexec service iptables restart"
I get the following error:
Cannot run program service: no such file or directory
So it has something to do with me passing pkexec
as a parameters.
...."pkexec /sbin/service iptables restart"