Enable telnet? Necessary for remote hddtemp

Can anyone help me on how to enable telnet on a Ubuntu 14.04 server? I want to enable the hddtemp component of HA but since it relies on a telnet connection, I can’t get it to work: user@ubuntu:~/.homeassistant# telnet 192.168.1.21 7634 telnet: Unable to connect to remote host: Connection refused

I’ve installed xinetd and telnetd, ufw is disabled. The hddtemp daemon is running according to ‘services --status-all’ Connecting locally to the hddtemp daemon with telnet or nc works fine but not from another machine.

(I know telnet is insecure blah blah blah, I’m only using it on my internal network

Edit: connecting to the telnet port 23 works fine!? user@ubuntu:~/.homeassistant# nc -v 192.168.1.21 23 Connection to 192.168.1.21 23 port [tcp/telnet] succeeded! ▒▒▒▒ ▒▒#▒▒'

Hi bonterra,

you don’t need telnet. It works just fine when you use the hddtemp sensor.
I’ve just tried it and it works out of the box without telnet, firewall changes or anything.

My config:

sensors:
   - platform: hddtemp
     host: "computer"

On my ubuntu machine:

user@computer:~$ sudo hddtemp -d /dev/sda1

Cheers,
Tobi

Thanks Toby but your solution implies running hddtemp and HA on the same computer. If the host supplied in the conf-file is anything else than the localhost, the component uses telnet to query the server.

I’m running HA on a VM but want to monitor the physical server so I need some kind of communication between them, in this case telnet.

No, it does not. I have home assistant running on a Raspberry Pi and the computer I was testing with is a different machine. Did you actually try it? What is your error message?

Yes, I have tried: cat home-assistant.log 17-02-13 22:10:13 ERROR (Thread-3) [homeassistant.components.sensor.hddtemp] HDDTemp is not available at 192.168.1.21:7634 17-02-13 22:10:13 ERROR (Thread-3) [homeassistant.components.sensor.hddtemp] Unable to fetch the data from 192.168.1.21:7634

(and yes, the server ip is correct)

I was chuckling reading this because I was reading the documentation for this last week and remember being confused at first. This conversation makes it more obvious that the docs could use some additional help.

I haven’t done this but from re-reading things I think …
hddtemp -d runs in daemon mode when it then listens for a tcp connection.
the sensor in HA just connects to the host/port running hddtemp and shazam. (it should work)

Same error even after running hddtemp -d /dev/sda on the server.

Please try

user@computer:~$ sudo hddtemp -d /dev/sda1

@cgtobi, I was already running it as root so no point in sudo’ing.

Running nmap to check for open ports
user@client:~$ nmap 192.168.1.21 Starting Nmap 6.40 ( http://nmap.org ) at 2017-02-14 09:05 CET Nmap scan for server (192.168.1.21) Host is up (0.0019 s latency). Not shown: 994 closed ports PORT STATE SERVICE 22/TCP OPEN ssh 25/TCP OPEN smtp 111/TCP OPEN rcpbind 139/TCP OPEN netbios-ssn 445/TCP OPEN microsoft-ds

Running netstat to check for connections
user@server:~$ sudo netstat -tapn | grep hddtemp tcp 0 0 127.0.0.1:7634 0.0.0.0:* LISTEN 2306/HDDTEMP

Addition to the above: I just found out that active network interfaces can be set in /etc/default/hddtemp. It was set to 127.0.0.1 (localhost) only but by replacing this with 0.0.0.0 all interfaces are enabled and remote calls are accepted after restarting the daemon.

So, is it working now?

Yes, thank you. It was indeed the interfaces setting in /etc/default/hddtemp