Search code examples
gosshnetwork-programmingcisco

SSH Unknown TTY Error Message


When trying to run the command ssh user@ip 'command', I keep receiving this error: can't get tty settingscan't set orig mode. I have tried googling this and searching here but have not found anything referring to this message. I am trying to automate connecting to a Cisco wireless access point (2800 model) using Golang to run a command then exit, but this message pops up each time. I can log in normally using ssh user@ap_ip, but using the shorthand ssh user@ap_ip 'command' or trying the equivalent in Golang gives the error message above. Anyone know what's going on?


Solution

  • ssh without explicit command given will allocate a terminal while ssh with a command given will by default not. It looks like the command you execute needs a terminal. In this case use the -t option, i.e. ssh -t user@ip command. From the documentation:

    -t      Force pseudo-terminal 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.