running a program through ssh fails with "Error opening terminal: unknown." running a program through ssh fails with "Error opening terminal: unknown." linux linux

running a program through ssh fails with "Error opening terminal: unknown."


A plain ssh command like that does not have a tty (terminal). Use the -t option to force ssh to open the terminal on its way in.

From the manual:

-t

Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g., when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.

So this would work (better):

ssh -t servername  ~/htopmem.sh