Posts

Showing posts from May, 2015

tcgetattr: Inappropriate ioctl for device

Recently a colleague of mine was working on a bash script to copy a script to a group of servers, run the script and display the output. The basic structure of the script was: for host in $(host_list); do echo "Host = $host" scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no check_script.rb user@${host}:/tmp/check_script.rb ssh -tt -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user@${host} 'chmod +x /tmp/check_script.rb' ssh -tt -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user@${host} 'sudo ruby check_script.rb' done When he attempted to run his script, it was failing after copying the script to the first remote host with the error tcgetattr: Inappropriate ioctl for device .  A google search turned up a bunch of results, but nothing helpful enough to resolve the issue. The issue turns out to be the ssh command requesting a TTY and erroring out because it is unable to get one.  Removing the -tt option fro