2

I have a problem running a ssh from crontab against a Fujitsu DX200 storage appliance.

When running the command from terminal everything works okay connecting using RSA keys, but when I embed the command in a script and run it from cron it fails with "Pseudo-terminal will not be allocated because stdin is not a terminal."

The command is ssh user@dx200 "show performance -type host-io"

According to many articles on the net, adding a number of -t as an argument to ssh it should force allocating PTY. On RedHat, where the script was developed, it works by adding -t -t -t (or -ttt) but that's not the case when running on Ubuntu.

Using ssh -T (Disable pseudo-tty allocation) makes the login to dx200 fail with "FUJITSU Storage ETERNUS login is required..." - that is, not logging in whit RSA key.

Other solutions from the net, using variants of ssh ... /bin/bash <<EOF ... is not possible because we cant launch a shell on the storage appliance.

Any ideas on how to circumvent this issue?

Melebius
  • 11,431
  • 9
  • 52
  • 78
Soren A
  • 6,799

1 Answers1

1

Answering my own question ...

Adding an extra -t argument to ssh solved the problem.

The command now looks like ssh -t -t -t -t user@dx200 ...... ( -tttt should do the same).

The man page on ssh say's this about -t:

 -t      Force pseudo-tty allocation.  This can be used to execute arbi-
         trary 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.

But nothing about how many 'Multiple' is, or what in the ssh code that governs the number of -t options required.

Soren A
  • 6,799