Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to exec a command to ssh into a host from a Tomcat instance that runs as Apache. This isn't working because of the following error:

debug1: read_passphrase: can't open /dev/tty: No such device or address

However, if I open a shell and manually su to the apache user, I can execute this command just fine.

Do I need to change configuration or can I possibly use the -t option with ssh to specify a device or address that exists?

share|improve this question
Were you prompted for a password when you run the ssh as apache user? – Khaled Nov 18 '11 at 19:28
@khaled no I use -o StrictHostKeyChecking=no , and that log entry is taken from using -v. The reason ssh is failing is because when Tomcat runs that command as Apache, there is no /dev/tty device. Apparently for the Tomcat process /dev/tty is not defined. – stevebot Nov 18 '11 at 19:34

This link says that this error may happen if the ssh requires some input. Another link says that you should create a missing /dev/tty file. A third link says that should find a way to tell you daemon to not open this file.

share|improve this answer
I'd like to try what's mentioned in the third link, but I haven't found any good explanation on the web. – stevebot Nov 18 '11 at 20:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.