I try to setup a switch to turn a linux server on and off.
The remote host is configured to run the sudo /sbin/poweroff
command without password and when I’m logged in there via ssh, it works.
However If I try ssh -i /ssl/ha_key -o StrictHostKeyChecking=no user@server sudo /sbin/poweroff
, it gives me:
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
So why is it working, when I’m logged in, but not if I want pass the command directly to ssh?